Class: Nzbn::Client
- Inherits:
-
Object
- Object
- Nzbn::Client
- Defined in:
- lib/nzbn/client.rb
Overview
Main HTTP client for NZBN API
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
- #addresses ⇒ Object
- #company_details ⇒ Object
- #delete(path, params = {}, headers = {}) ⇒ Object
- #email_addresses ⇒ Object
-
#entities ⇒ Object
API Resource Accessors.
-
#get(path, params = {}, headers = {}) ⇒ Object
HTTP Methods.
- #history ⇒ Object
- #industry_classifications ⇒ Object
-
#initialize(api_key: nil, base_url: nil, timeout: nil) ⇒ Client
constructor
A new instance of Client.
- #organisation_parts ⇒ Object
- #patch(path, body = {}, headers = {}) ⇒ Object
- #phone_numbers ⇒ Object
- #post(path, body = {}, headers = {}) ⇒ Object
- #privacy_settings ⇒ Object
- #put(path, body = {}, headers = {}) ⇒ Object
- #roles ⇒ Object
- #trading_names ⇒ Object
- #watchlists ⇒ Object
- #websites ⇒ Object
Constructor Details
#initialize(api_key: nil, base_url: nil, timeout: nil) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 23 24 25 |
# File 'lib/nzbn/client.rb', line 18 def initialize(api_key: nil, base_url: nil, timeout: nil) @configuration = Nzbn.configuration&.dup || Configuration.new @configuration.api_key = api_key if api_key @configuration.base_url = base_url if base_url @configuration.timeout = timeout if timeout validate_configuration! end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
16 17 18 |
# File 'lib/nzbn/client.rb', line 16 def configuration @configuration end |
Instance Method Details
#addresses ⇒ Object
33 34 35 |
# File 'lib/nzbn/client.rb', line 33 def addresses @addresses ||= Api::Addresses.new(self) end |
#company_details ⇒ Object
65 66 67 |
# File 'lib/nzbn/client.rb', line 65 def company_details @company_details ||= Api::CompanyDetails.new(self) end |
#delete(path, params = {}, headers = {}) ⇒ Object
99 100 101 |
# File 'lib/nzbn/client.rb', line 99 def delete(path, params = {}, headers = {}) request(:delete, path, params, headers) end |
#email_addresses ⇒ Object
49 50 51 |
# File 'lib/nzbn/client.rb', line 49 def email_addresses @email_addresses ||= Api::EmailAddresses.new(self) end |
#entities ⇒ Object
API Resource Accessors
29 30 31 |
# File 'lib/nzbn/client.rb', line 29 def entities @entities ||= Api::Entities.new(self) end |
#get(path, params = {}, headers = {}) ⇒ Object
HTTP Methods
83 84 85 |
# File 'lib/nzbn/client.rb', line 83 def get(path, params = {}, headers = {}) request(:get, path, params, headers) end |
#history ⇒ Object
77 78 79 |
# File 'lib/nzbn/client.rb', line 77 def history @history ||= Api::History.new(self) end |
#industry_classifications ⇒ Object
57 58 59 |
# File 'lib/nzbn/client.rb', line 57 def industry_classifications @industry_classifications ||= Api::IndustryClassifications.new(self) end |
#organisation_parts ⇒ Object
73 74 75 |
# File 'lib/nzbn/client.rb', line 73 def organisation_parts @organisation_parts ||= Api::OrganisationParts.new(self) end |
#patch(path, body = {}, headers = {}) ⇒ Object
95 96 97 |
# File 'lib/nzbn/client.rb', line 95 def patch(path, body = {}, headers = {}) request(:patch, path, body, headers) end |
#phone_numbers ⇒ Object
45 46 47 |
# File 'lib/nzbn/client.rb', line 45 def phone_numbers @phone_numbers ||= Api::PhoneNumbers.new(self) end |
#post(path, body = {}, headers = {}) ⇒ Object
87 88 89 |
# File 'lib/nzbn/client.rb', line 87 def post(path, body = {}, headers = {}) request(:post, path, body, headers) end |
#privacy_settings ⇒ Object
61 62 63 |
# File 'lib/nzbn/client.rb', line 61 def privacy_settings @privacy_settings ||= Api::PrivacySettings.new(self) end |
#put(path, body = {}, headers = {}) ⇒ Object
91 92 93 |
# File 'lib/nzbn/client.rb', line 91 def put(path, body = {}, headers = {}) request(:put, path, body, headers) end |
#roles ⇒ Object
37 38 39 |
# File 'lib/nzbn/client.rb', line 37 def roles @roles ||= Api::Roles.new(self) end |
#trading_names ⇒ Object
41 42 43 |
# File 'lib/nzbn/client.rb', line 41 def trading_names @trading_names ||= Api::TradingNames.new(self) end |
#watchlists ⇒ Object
69 70 71 |
# File 'lib/nzbn/client.rb', line 69 def watchlists @watchlists ||= Api::Watchlists.new(self) end |