Class: EloquaApiService::Service
- Inherits:
-
Object
- Object
- EloquaApiService::Service
- Includes:
- HTTParty
- Defined in:
- lib/eloqua_api_service/service.rb
Direct Known Subclasses
Campaign, Contact, ContactList, ContactSegment, CustomObject, Email, Folder, Form, OptionList, Program, User, Visitor
Instance Method Summary collapse
-
#initialize(account: nil) ⇒ Service
constructor
A new instance of Service.
- #parse(response) ⇒ Object
- #parse_body(body) ⇒ Object
Constructor Details
#initialize(account: nil) ⇒ Service
Returns a new instance of Service.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/eloqua_api_service/service.rb', line 9 def initialize(account: nil) @credentials = Credential.new.find(account: account) self.class.base_uri @credentials.service = { headers: { 'Authorization' => "Basic #{@credentials.password}", 'Content-Type' => 'application/json' }, body: {} } end |
Instance Method Details
#parse(response) ⇒ Object
22 23 24 |
# File 'lib/eloqua_api_service/service.rb', line 22 def parse(response) JSON.parse(response.body, symbolize_names: true) end |
#parse_body(body) ⇒ Object
26 27 28 |
# File 'lib/eloqua_api_service/service.rb', line 26 def parse_body(body) JSON.parse(body, symbolize_names: true) end |