Class: Erede::Environment
- Inherits:
-
Object
- Object
- Erede::Environment
- Defined in:
- lib/erede/environment.rb
Constant Summary collapse
- PRODUCTION =
'https://api.userede.com.br/erede'- SANDBOX =
'https://api.userede.com.br/desenvolvedores'- API_VERSION =
'v1'
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(endpoint) ⇒ Environment
constructor
A new instance of Environment.
- #to_json ⇒ Object
Constructor Details
#initialize(endpoint) ⇒ Environment
Returns a new instance of Environment.
11 12 13 |
# File 'lib/erede/environment.rb', line 11 def initialize(endpoint) @endpoint = "#{endpoint}/#{API_VERSION}" end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/erede/environment.rb', line 7 def endpoint @endpoint end |
#ip ⇒ Object
Returns the value of attribute ip.
7 8 9 |
# File 'lib/erede/environment.rb', line 7 def ip @ip end |
#session_id ⇒ Object
Returns the value of attribute session_id.
7 8 9 |
# File 'lib/erede/environment.rb', line 7 def session_id @session_id end |
Class Method Details
.production ⇒ Object
15 16 17 |
# File 'lib/erede/environment.rb', line 15 def self.production new(PRODUCTION) end |
.sandbox ⇒ Object
19 20 21 |
# File 'lib/erede/environment.rb', line 19 def self.sandbox new(SANDBOX) end |
Instance Method Details
#to_json ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/erede/environment.rb', line 23 def to_json(*) { consumer: { ip: @ip, sessionId: @sessionId } }.delete_if { |k, v| v.nil? }.to_json end |