Class: Sms77::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/sms77/resource.rb

Constant Summary collapse

BASE_PATH =
'/api/'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_keyObject (readonly)

Returns the value of attribute api_key.



10
11
12
# File 'lib/sms77/resource.rb', line 10

def api_key
  @api_key
end

#builderObject (readonly)

Returns the value of attribute builder.



10
11
12
# File 'lib/sms77/resource.rb', line 10

def builder
  @builder
end

#connObject (readonly)

Returns the value of attribute conn.



10
11
12
# File 'lib/sms77/resource.rb', line 10

def conn
  @conn
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



10
11
12
# File 'lib/sms77/resource.rb', line 10

def endpoint
  @endpoint
end

#http_methodsObject (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_methodsObject (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_withObject (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_endpointObject



88
89
90
# File 'lib/sms77/resource.rb', line 88

def get_endpoint
  @endpoint
end

.get_http_methodsObject



84
85
86
# File 'lib/sms77/resource.rb', line 84

def get_http_methods
  @http_methods
end