Class: SellsyV2::Company
- Inherits:
-
Object
- Object
- SellsyV2::Company
- Defined in:
- lib/sellsy_v2/company.rb,
lib/sellsy_v2/company/address.rb
Defined Under Namespace
Classes: Address
Constant Summary collapse
- ROOT_PATH =
'/companies'
Class Method Summary collapse
Instance Method Summary collapse
- #addresses(**options) ⇒ Object
-
#initialize(attr) ⇒ Company
constructor
A new instance of Company.
Constructor Details
#initialize(attr) ⇒ Company
Returns a new instance of Company.
8 9 10 11 12 13 14 15 |
# File 'lib/sellsy_v2/company.rb', line 8 def initialize(attr) attr.each do |k,v| define_singleton_method(k) { instance_variable_get("@#{k}") } define_singleton_method("#{k}=") { |val| instance_variable_set("@#{k}", val) } instance_variable_set("@#{k}", v) end end |
Class Method Details
Instance Method Details
#addresses(**options) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/sellsy_v2/company.rb', line 31 def addresses(**) verb = 'get' path = "#{ROOT_PATH}/#{id}/addresses" company_addresses_response = Request.new(path: path, verb: verb, options: ).call if company_addresses_response.success? company_addresses_response.data.dig('data').map{Address.new(_1)} end end |