Class: Straight
- Inherits:
-
Object
- Object
- Straight
- Includes:
- HTTParty
- Defined in:
- lib/straight-api.rb,
lib/straight-api/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
- #create(amount, options = {}) ⇒ Object
- #get(id, options = {}) ⇒ Object
-
#initialize(uri, gateway, options = {}) ⇒ Straight
constructor
A new instance of Straight.
Constructor Details
#initialize(uri, gateway, options = {}) ⇒ Straight
Returns a new instance of Straight.
9 10 11 12 |
# File 'lib/straight-api.rb', line 9 def initialize (uri, gateway, ={}) self.class.base_uri "#{uri}/gateways/#{gateway}" @options = {query: } end |
Instance Method Details
#create(amount, options = {}) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/straight-api.rb', line 14 def create (amount, ={}) .merge!(@options) .merge!({amount: amount}) = {query: } Hashie::Mash.new(JSON.parse(self.class.post('/orders', ))) end |
#get(id, options = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/straight-api.rb', line 21 def get (id, ={}) .merge!(@options) = {query: } Hashie::Mash.new(JSON.parse(self.class.get("/orders/#{id}", ))) end |