Class: Myxy::Client

Inherits:
Object
  • Object
show all
Includes:
Request
Defined in:
lib/myxy/client.rb

Instance Method Summary collapse

Methods included from Request

#delete, #get, #post, #put

Constructor Details

#initialize(options = {}) ⇒ Client

Creates a new API



11
12
13
14
15
16
# File 'lib/myxy/client.rb', line 11

def initialize(options = {})
  options = Myxy.options.merge(options)
  Config::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end

Instance Method Details

#configObject



29
30
31
32
33
34
35
# File 'lib/myxy/client.rb', line 29

def config
  conf = {}
  Config::VALID_OPTIONS_KEYS.each do |key|
    conf[key] = send key
  end
  conf
end

#connectionObject



18
19
20
21
22
23
# File 'lib/myxy/client.rb', line 18

def connection
  Faraday.new(url) do |faraday|
    faraday.adapter Faraday.default_adapter
    faraday.port = 443
  end
end

#urlObject



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

def url
  URI.join(base_url, version)
end