Class: Demio::Client

Inherits:
Object
  • Object
show all
Includes:
Event, EventDate, Events, Participants, Register
Defined in:
lib/demio/event.rb,
lib/demio/client.rb,
lib/demio/events.rb,
lib/demio/register.rb,
lib/demio/event_date.rb,
lib/demio/participants.rb

Defined Under Namespace

Modules: Event, EventDate, Events, Participants, Register

Constant Summary collapse

REQUEST_REDIRECT_FOLLOW_LIMIT =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Register

#register

Methods included from Participants

#participants

Methods included from Events

#events

Methods included from EventDate

#event_date

Methods included from Event

#event

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



25
26
27
28
# File 'lib/demio/client.rb', line 25

def initialize(options = {})
  @api_key = options[:api_key]
  @api_secret = options[:api_secret]
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



21
22
23
# File 'lib/demio/client.rb', line 21

def api_key
  @api_key
end

#api_secretObject (readonly)

Returns the value of attribute api_secret.



21
22
23
# File 'lib/demio/client.rb', line 21

def api_secret
  @api_secret
end

Instance Method Details

#get(uri) ⇒ Object



30
31
32
# File 'lib/demio/client.rb', line 30

def get(uri)
  make_request(Net::HTTP::Get, uri)
end

#pingObject



38
39
40
41
42
43
# File 'lib/demio/client.rb', line 38

def ping
  make_request(
    Net::HTTP::Get,
    "ping/query?api_key=#{api_key}&api_secret=#{api_secret}"
  )
end

#put(uri, payload) ⇒ Object



34
35
36
# File 'lib/demio/client.rb', line 34

def put(uri, payload)
  make_request(Net::HTTP::Put, uri, payload)
end