Class: EcalClient::Api
- Inherits:
-
Object
- Object
- EcalClient::Api
- Defined in:
- lib/ecal_client/api.rb
Defined Under Namespace
Constant Summary collapse
- API_VERSION =
"/apiv2".freeze
- ORGANISATION =
"/organisation/".freeze
- PUBLISHER =
"/publisher/".freeze
- CALENDAR =
"/calendar/".freeze
- EVENT =
"/event/".freeze
- SUBSCRIPTION_WIDGET =
"/subscription-widget/".freeze
- SUBSCRIBER =
"/subscriber/".freeze
Instance Method Summary collapse
- #calendar ⇒ Object
- #credentials ⇒ Object
- #event ⇒ Object
-
#initialize(options = {}) ⇒ Api
constructor
A new instance of Api.
- #organisation ⇒ Object
- #publisher ⇒ Object
- #subscriber ⇒ Object
- #subscription_widget ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Api
Returns a new instance of Api.
12 13 14 15 16 |
# File 'lib/ecal_client/api.rb', line 12 def initialize( = {}) @key = .delete(:key) || EcalClient.configuration.key @secret = .delete(:secret) || EcalClient.configuration.secret EcalClient.configuration..merge!() end |
Instance Method Details
#calendar ⇒ Object
30 31 32 |
# File 'lib/ecal_client/api.rb', line 30 def calendar @calendar ||= Rest.new(endpoint_for(CALENDAR), [:get, :post, :put], credentials) end |
#credentials ⇒ Object
18 19 20 |
# File 'lib/ecal_client/api.rb', line 18 def credentials { key: @key, secret: @secret } end |
#event ⇒ Object
34 35 36 |
# File 'lib/ecal_client/api.rb', line 34 def event @event ||= Rest.new(endpoint_for(EVENT), [:get, :post, :put], credentials) end |
#organisation ⇒ Object
22 23 24 |
# File 'lib/ecal_client/api.rb', line 22 def organisation @organisation ||= Rest.new(endpoint_for(ORGANISATION), [:get, :post, :put], credentials) end |
#publisher ⇒ Object
26 27 28 |
# File 'lib/ecal_client/api.rb', line 26 def publisher @publisher ||= Rest.new(endpoint_for(PUBLISHER), [:get, :put], credentials) end |
#subscriber ⇒ Object
42 43 44 |
# File 'lib/ecal_client/api.rb', line 42 def subscriber @subscriber ||= Rest.new(endpoint_for(SUBSCRIBER), [:get, :post, :put], credentials) end |
#subscription_widget ⇒ Object
38 39 40 |
# File 'lib/ecal_client/api.rb', line 38 def @subscription_widget ||= Rest.new(endpoint_for(SUBSCRIPTION_WIDGET), [:get], credentials) end |