Class: SevenApi::Resource
- Inherits:
-
Object
- Object
- SevenApi::Resource
- Defined in:
- lib/seven_api/resource.rb
Direct Known Subclasses
SevenApi::Resources::Analytics, SevenApi::Resources::Balance, SevenApi::Resources::Contacts, SevenApi::Resources::Groups, SevenApi::Resources::Hooks, SevenApi::Resources::Journal, SevenApi::Resources::Lookup, SevenApi::Resources::Pricing, SevenApi::Resources::Rcs, SevenApi::Resources::Sms, SevenApi::Resources::Status, SevenApi::Resources::Subaccounts, SevenApi::Resources::ValidateForVoice, SevenApi::Resources::Voice
Constant Summary collapse
- BASE_PATH =
'/api/'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#http_methods ⇒ Object
readonly
Returns the value of attribute http_methods.
-
#request_methods ⇒ Object
readonly
Returns the value of attribute request_methods.
-
#sent_with ⇒ Object
readonly
Returns the value of attribute sent_with.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_key, sent_with = 'ruby') ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(api_key, sent_with = 'ruby') ⇒ Resource
Returns a new instance of Resource.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/seven_api/resource.rb', line 15 def initialize(api_key, sent_with = 'ruby') raise 'missing api_key in config' if api_key.to_s.empty? raise 'missing sent_with in config' if sent_with.to_s.empty? @api_key = api_key @sent_with = sent_with @endpoint = self.class.get_endpoint @http_methods = self.class.get_http_methods @conn = Faraday.new("https://gateway.seven.io#{BASE_PATH}") end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/seven_api/resource.rb', line 11 def api_key @api_key end |
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
11 12 13 |
# File 'lib/seven_api/resource.rb', line 11 def builder @builder end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
11 12 13 |
# File 'lib/seven_api/resource.rb', line 11 def conn @conn end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
11 12 13 |
# File 'lib/seven_api/resource.rb', line 11 def endpoint @endpoint end |
#http_methods ⇒ Object (readonly)
Returns the value of attribute http_methods.
11 12 13 |
# File 'lib/seven_api/resource.rb', line 11 def http_methods @http_methods end |
#request_methods ⇒ Object (readonly)
Returns the value of attribute request_methods.
11 12 13 |
# File 'lib/seven_api/resource.rb', line 11 def request_methods @request_methods end |
#sent_with ⇒ Object (readonly)
Returns the value of attribute sent_with.
11 12 13 |
# File 'lib/seven_api/resource.rb', line 11 def sent_with @sent_with end |
Class Method Details
.get_endpoint ⇒ Object
94 95 96 |
# File 'lib/seven_api/resource.rb', line 94 def get_endpoint @endpoint end |
.get_http_methods ⇒ Object
90 91 92 |
# File 'lib/seven_api/resource.rb', line 90 def get_http_methods @http_methods end |