Class: CreditDevice::Company
- Inherits:
-
Object
- Object
- CreditDevice::Company
- Defined in:
- lib/credit_device/company.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#term ⇒ Object
readonly
Returns the value of attribute term.
Instance Method Summary collapse
- #get_all ⇒ Object
-
#initialize(term, country, page = 1, **parameter) ⇒ Company
constructor
A new instance of Company.
- #path ⇒ Object
- #set_type(type) ⇒ Object
Constructor Details
#initialize(term, country, page = 1, **parameter) ⇒ Company
5 6 7 8 9 10 |
# File 'lib/credit_device/company.rb', line 5 def initialize(term, country, page = 1, **parameter) @term = term @country = country @page = page @type = parameter[:type] ? set_type(parameter[:type]) : CreditDevice::Type::QueryParameterType::DEFAULT end |
Instance Attribute Details
#country ⇒ Object (readonly)
Returns the value of attribute country.
3 4 5 |
# File 'lib/credit_device/company.rb', line 3 def country @country end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/credit_device/company.rb', line 3 def page @page end |
#term ⇒ Object (readonly)
Returns the value of attribute term.
3 4 5 |
# File 'lib/credit_device/company.rb', line 3 def term @term end |
Instance Method Details
#get_all ⇒ Object
12 13 14 |
# File 'lib/credit_device/company.rb', line 12 def get_all CreditDevice::Client.new(:get, path).request end |
#path ⇒ Object
16 17 18 |
# File 'lib/credit_device/company.rb', line 16 def path "companies?#{@type}=#{@term}&country=#{@country}&page=#{@page}" end |
#set_type(type) ⇒ Object
20 21 22 23 |
# File 'lib/credit_device/company.rb', line 20 def set_type(type) raise "type invalid, parameters are: #{CreditDevice::Type::QueryParameterType::QUERY_TYPES.join(',')}" unless CreditDevice::Type::QueryParameterType::QUERY_TYPES.include? type type end |