Sha256: 95ed2fcf4e70f1d434293819fb831627fdada8e3f57ebce25815a354f7436d9e

Contents?: true

Size: 869 Bytes

Versions: 9

Compression:

Stored size: 869 Bytes

Contents

module Youroom
  class AddUser < Request
    attr_reader :attributes, :billing_id

    def initialize(access_token, billing_id, attributes, url=BASE_URL)
      required_structure(billing_id, String, Fixnum)
      required_structure(attributes, Hash)
      @billing_id, @attributes = billing_id.to_s, attributes
      super(access_token, url)
    end

    def path
      File.join(url, 'billings', billing_id, 'billing_users?format=json')
    end

    def params
      { :billing_user => { :name => name,
                           :user_attributes => { :email => email,
                                                 :password => password,
                                                 :password_confirmation => password_confirmation }}}.optimize
    end

    # TODO: refactoring
    def method_missing(name, *args)
      attributes[name.to_sym]
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
youroom_api-0.1.4 lib/youroom_api/request/add_user.rb
youroom_api-0.1.3 lib/youroom_api/request/add_user.rb
youroom_api-0.1.2 lib/youroom_api/request/add_user.rb
youroom_api-0.1.1 lib/youroom_api/request/add_user.rb
youroom_api-0.1.0 lib/youroom_api/request/add_user.rb
youroom_api-0.0.13 lib/youroom_api/request/add_user.rb
youroom_api-0.0.12 lib/youroom_api/request/add_user.rb
youroom_api-0.0.11 lib/youroom_api/request/add_user.rb
youroom_api-0.0.10 lib/youroom_api/request/add_user.rb