Class: Sms77::Resource
- Inherits:
-
Object
- Object
- Sms77::Resource
- Defined in:
- lib/sms77/resource.rb
Direct Known Subclasses
Sms77::Resources::Analytics, Sms77::Resources::Balance, Sms77::Resources::Contacts, Sms77::Resources::Hooks, Sms77::Resources::Journal, Sms77::Resources::Lookup, Sms77::Resources::Pricing, Sms77::Resources::Sms, Sms77::Resources::Status, Sms77::Resources::ValidateForVoice, Sms77::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.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sms77/resource.rb', line 14 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.sms77.io#{BASE_PATH}") end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/sms77/resource.rb', line 10 def api_key @api_key end |
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
10 11 12 |
# File 'lib/sms77/resource.rb', line 10 def builder @builder end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
10 11 12 |
# File 'lib/sms77/resource.rb', line 10 def conn @conn end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
10 11 12 |
# File 'lib/sms77/resource.rb', line 10 def endpoint @endpoint end |
#http_methods ⇒ Object (readonly)
Returns the value of attribute http_methods.
10 11 12 |
# File 'lib/sms77/resource.rb', line 10 def http_methods @http_methods end |
#request_methods ⇒ Object (readonly)
Returns the value of attribute request_methods.
10 11 12 |
# File 'lib/sms77/resource.rb', line 10 def request_methods @request_methods end |
#sent_with ⇒ Object (readonly)
Returns the value of attribute sent_with.
10 11 12 |
# File 'lib/sms77/resource.rb', line 10 def sent_with @sent_with end |
Class Method Details
.get_endpoint ⇒ Object
88 89 90 |
# File 'lib/sms77/resource.rb', line 88 def get_endpoint @endpoint end |
.get_http_methods ⇒ Object
84 85 86 |
# File 'lib/sms77/resource.rb', line 84 def get_http_methods @http_methods end |