yotpo 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -91,6 +91,53 @@ response.body.bottomline.average_score
91
91
 
92
92
  Now lets try something a little bit more complicated. Lets try to create a purchase.
93
93
 
94
+ For that we will need to go through Yotpo authenticaton process, provide an app_key and secret, and return to get the utoken. The utoken will allow us to make authenticated API calls.
95
+
96
+ ```ruby
97
+ ak = "d3n27Sg0eP8MHmVCHfPdQzyxjhwIEeV5cBKhoggC" #remember to replace the APP_KEY with your own.
98
+ st = "adsfasdf68ads6fadsfkjbhkljhciolqewrnqwew" #remember to replace the SECRET with your own.
99
+
100
+
101
+ # retrieving the utoken - will be valid for 24 hours
102
+ response = Yotpo.get_oauth_token :app_key => ak, :secret => st
103
+ utoken = response.body.access_token
104
+
105
+ #first creating the products that are in the order, notice that the key of the product hash is the product_sku
106
+ products = {
107
+ "BLABLA1" => {
108
+ :url => "http://shop.yotpo.com/products/amazing-yotpo-poster",
109
+ :name => "Yotpo Amazing Poster",
110
+ :image_url => "http://cdn.shopify.com/s/files/1/0098/1912/products/qa2_medium.png?41",
111
+ :description => "this is the most awesome poster in the world!",
112
+ :price => "100"
113
+ }
114
+ }
115
+
116
+ # now we will create a purchase using this the token we have received in the previous step
117
+
118
+ response = Yotpo.create_new_purchase :app_key => ak,
119
+ :utoken => utoken,
120
+ :email => "trial@yotpo.com",
121
+ :customer_name => "bob",
122
+ :order_id => "12999",
123
+ :platform => "Shopify",
124
+ :order_date => "2013-05-28",
125
+ :products => products,
126
+ :currency_iso => "USD"
127
+
128
+ #making sure our request went through
129
+
130
+ raise Exception unless response.body.code == 200
131
+
132
+ ```
133
+
134
+ We can pull all the purchases of a certain account to make sure that the previous calls has worked
135
+
136
+ ```ruby
137
+
138
+ response = Yotpo.get_purchases :app_key => ak, :utoken => utoken, :since_date => "2013-05-26"
139
+
140
+ ```
94
141
 
95
142
 
96
143
  [register]: https://www.yotpo.com/register
data/changelog CHANGED
@@ -14,3 +14,4 @@
14
14
  2013-05-26 Omri Cohen
15
15
  1. Adding support in purchase.rb for order_date and currency_iso
16
16
  2. increasing version to 0.0.7
17
+ 3. fixing the purchases mass create functionality, increasing to 0.0.8
@@ -18,6 +18,7 @@ module Yotpo
18
18
  def create_new_purchases(params)
19
19
  request = {
20
20
  utoken: params[:utoken],
21
+ platform: params[:platform],
21
22
  orders: params[:orders]
22
23
  }
23
24
  app_key = params[:app_key]
data/lib/yotpo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yotpo
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yotpo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: