Class: MobilizeAmericaClient::Client
- Inherits:
-
Object
- Object
- MobilizeAmericaClient::Client
- Includes:
- Enums, Events, Organizations, Request
- Defined in:
- lib/mobilize_america_client/client.rb,
lib/mobilize_america_client/client/enums.rb,
lib/mobilize_america_client/client/events.rb,
lib/mobilize_america_client/client/organizations.rb
Defined Under Namespace
Modules: Enums, Events, Organizations
Constant Summary
Constants included from Request
Request::API_BASE_PATH, Request::API_DOMAIN
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #create_organization_event_attendance(organization_id:, event_id:, attendance_data:) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #organization_event(organization_id:, event_id:) ⇒ Object
- #organization_event_attendances(organization_id:, event_id:) ⇒ Object
Methods included from Organizations
Methods included from Events
Methods included from Enums
Methods included from Request
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 |
# File 'lib/mobilize_america_client/client.rb', line 13 def initialize( = {}) self.api_key = [:api_key] api_domain = [:api_domain] || API_DOMAIN @connection = Faraday.new(url: "https://#{api_domain}", request: { params_encoder: Faraday::FlatParamsEncoder }) end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/mobilize_america_client/client.rb', line 11 def api_key @api_key end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
10 11 12 |
# File 'lib/mobilize_america_client/client.rb', line 10 def connection @connection end |
Instance Method Details
#create_organization_event_attendance(organization_id:, event_id:, attendance_data:) ⇒ Object
69 70 71 |
# File 'lib/mobilize_america_client/client/events.rb', line 69 def create_organization_event_attendance(organization_id:, event_id:, attendance_data:) post(path: "/organizations/#{esc(organization_id)}/events/#{esc(event_id)}/attendances", body: attendance_data) end |
#organization_event(organization_id:, event_id:) ⇒ Object
61 62 63 |
# File 'lib/mobilize_america_client/client/events.rb', line 61 def organization_event(organization_id:, event_id:) get(path: "/organizations/#{esc(organization_id)}/events/#{esc(event_id)}") end |
#organization_event_attendances(organization_id:, event_id:) ⇒ Object
65 66 67 |
# File 'lib/mobilize_america_client/client/events.rb', line 65 def organization_event_attendances(organization_id:, event_id:) get(path: "/organizations/#{esc(organization_id)}/events/#{esc(event_id)}/attendances") end |