tictail-api 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aff7d6222b977b0110cfe26d886037dc98a52c7d
4
- data.tar.gz: 2cc1fbdd4158fd8702bf987e224c8007e7462da9
3
+ metadata.gz: dcefe25e9770abc1fb0577874c551b0fc1168df4
4
+ data.tar.gz: 22bc88f17dc265b8af8432cc3053335d6aba2468
5
5
  SHA512:
6
- metadata.gz: 450a602f765d1df9b3bbb98a9ee13fee0373c74942196da4db685866fc2487dd2e8d84fed9d1a689d77674ed9ffd2643c207741950d50677221a28f1199a34d2
7
- data.tar.gz: 905f22cca16c018ddad388b661eb01fe46e1711e66a7cefdec144a9d782a95e424370fa335bae632540962c0830394ad0133d8818b49da133627bf6315674558
6
+ metadata.gz: 142bb6653e32cfbcf375621be038258c68cba98e2d0e5b00c4104a9b1f5fc436c08a4b0cef6d56413b4ce5020b7fafb3cf7ab5f89469b78724473930738e1cc8
7
+ data.tar.gz: c0988c13baaef1bed3dedfbc7a3c65e4ec078ff09c34af770bc59a8b1449f0f3ef69ecf1a0dd44ba082dbd1c1ae0c11594e0c5dfa1f9da87007a62d3fad10b96
data/changelog CHANGED
@@ -1,2 +1,5 @@
1
1
  2013-07-25 Alon Braitstein
2
- 1. Initial commit
2
+ 1. Initial commit
3
+
4
+ 2013-08-28 Alon Braitstein
5
+ 1. Add card posting.
@@ -0,0 +1,11 @@
1
+ module Tictail
2
+ module Api
3
+ module Card
4
+ def post_card params
5
+ raise InvalidParams.new('No store id spacified') unless params[:store_id]
6
+ response = post("/v1/stores/#{params[:store_id]}/cards" , params)
7
+ response.body
8
+ end
9
+ end
10
+ end
11
+ end
@@ -13,6 +13,7 @@ require 'tictail/helper'
13
13
  require 'tictail/api/order'
14
14
  require 'tictail/api/product'
15
15
  require 'tictail/api/customer'
16
+ require 'tictail/api/card'
16
17
 
17
18
 
18
19
 
@@ -25,6 +26,7 @@ module Tictail
25
26
  include Tictail::Api::Order
26
27
  include Tictail::Api::Product
27
28
  include Tictail::Api::Customer
29
+ include Tictail::Api::Card
28
30
 
29
31
  attr_accessor :access_token
30
32
 
@@ -43,7 +45,7 @@ module Tictail
43
45
  # @param url [String] the relative path in the Tictail API
44
46
  # @param params [Hash] the url params that should be passed in the request
45
47
  def get(url, params = {})
46
- params = params.inject({}){|memo,(k,v)| memo[k.to_s] = v; memo}
48
+ params = convert_hash_keys(params)
47
49
  @access_token = params.delete('access_token') if params['access_token']
48
50
  return connection.get(url, params)
49
51
  end
@@ -96,6 +98,5 @@ module Tictail
96
98
  end
97
99
  end
98
100
  end
99
-
100
101
  class InvalidParams < Exception; end
101
102
  end
@@ -1,5 +1,5 @@
1
1
  module Tictail
2
2
  module Api
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ module Tictail
4
4
  # "env" contains the request
5
5
  @app.call(env).on_complete do
6
6
  if env[:status] == 401 || env[:status] == 403
7
- raise HTTPUnauthorized.new 'invalid storeenvy credentials'
7
+ raise HTTPUnauthorized.new 'invalid tictail credentials'
8
8
  end
9
9
  end
10
10
  end
@@ -1,8 +1,5 @@
1
1
  module Tictail
2
2
  module Helper
3
- def symbolize_keys hash
4
- return hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
5
- end
6
3
  def convert_hash_keys(value)
7
4
  case value
8
5
  when Array
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tictail-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alon Braitstein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-06 00:00:00.000000000 Z
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,7 @@ files:
108
108
  - Rakefile
109
109
  - changelog
110
110
  - lib/tictail/api/authenticate.rb
111
+ - lib/tictail/api/card.rb
111
112
  - lib/tictail/api/client.rb
112
113
  - lib/tictail/api/customer.rb
113
114
  - lib/tictail/api/order.rb