Class: BTCJammer::AutomaticPlans

Inherits:
Object
  • Object
show all
Defined in:
lib/btcjammer/automatic_plans.rb

Overview

Class Method Summary collapse

Class Method Details

.all(access_token) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/btcjammer/automatic_plans.rb', line 16

def self.all(access_token)
  token = BTCJammer.get_client access_token
  response = token.get("#{API_URL}/automatic_plans.json")

  result = OpenStruct.new JSON.parse(response.body)
  result.collect { |r| OpenStruct.new r }
end

.create(access_token, params) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/btcjammer/automatic_plans.rb', line 8

def self.create(access_token, params)
  token    = BTCJammer.get_client access_token
  response = token.post("#{API_URL}/automatic_plans.json", body: { automatic_plan: params.to_json })

  result = OpenStruct.new JSON.parse(response.body)
  OpenStruct.new(result.automatic_plan)
end