megam_api 0.52 → 0.53

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efb3b538b59b4202914e5b5258d6116ed2fd3147
4
- data.tar.gz: 43a27dd9a928bb3428793c5c0e6dd174352e410e
3
+ metadata.gz: 8ca9e626deed7bb1c3e51603cdf3ba8e942b1fff
4
+ data.tar.gz: 23da3d313850bdc4d822a9d372127af1b5d78b50
5
5
  SHA512:
6
- metadata.gz: 04259a55304074084b0bbbf5951b184bcefddae9bbf2dd459e403d2a0a6f6f1616b862f91377d67665a67e98d9ed5d22be43609c25b6160ad07b29f6d43f25df
7
- data.tar.gz: ce62a8c7dccf35fa9ac8cc0e342c4f352533c0b3ad2825d65799e4824b85c56e7ef349ab482781e36e845324d295eca97b364bd2f938d20bddfafe1d0300a2d8
6
+ metadata.gz: dd7d9ecb822284bdeb76f9a888eca90968cdb6c97e3b2d2269c9250346a69b516c66a6ff34553f118f1711d6adf688da704d94b6ae2f68708ba3a5272148de25
7
+ data.tar.gz: 0009747a1d0b5abef1febe1687d7c7b8dc0f7216c41eb6fffaae0ce9c871b913e7e5778976398cf96cdfa44c5b594cb96631bdd909e76af4c915e9cc6d55b368
@@ -30,6 +30,19 @@ module Megam
30
30
  :body => @options[:body]
31
31
  )
32
32
  end
33
+
34
+
35
+ def update_discounts(update_discount)
36
+ @options = {:path => '/discounts/update',
37
+ :body => Megam::JSONCompat.to_json(update_discount)}.merge(@options)
38
+
39
+ request(
40
+ :expects => 201,
41
+ :method => :post,
42
+ :body => @options[:body]
43
+ )
44
+
45
+ end
33
46
 
34
47
  end
35
48
  end
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.52"
3
+ VERSION = "0.53"
4
4
  end
5
5
  end
@@ -213,7 +213,7 @@ module Megam
213
213
  end
214
214
 
215
215
  def self.update(params)
216
- asm = from_hash(params, params["email"], params["api_key"])
216
+ asm = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key])
217
217
  asm.update
218
218
  end
219
219
 
@@ -237,7 +237,7 @@ module Megam
237
237
  end
238
238
 
239
239
  def self.update(params)
240
- asm = from_hash(params, params["email"], params["api_key"])
240
+ asm = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key])
241
241
  asm.update
242
242
  end
243
243
 
@@ -158,15 +158,29 @@ module Megam
158
158
  self
159
159
  end
160
160
 
161
- def self.create(o,tmp_email=nil, tmp_api_key=nil)
162
- acct = from_hash(o,tmp_email, tmp_api_key)
163
- acct.create
161
+ def self.create(params)
162
+ puts "creating discounts entry...hold tight"
163
+ puts params.inspect
164
+ discount = from_hash(params)
165
+ discount.create
164
166
  end
165
167
 
166
168
  # Create the discounts via the REST API
167
169
  def create
170
+ puts "YES. CREATING....JUST A SEC"
171
+ puts to_hash
168
172
  megam_rest.post_discounts(to_hash)
169
173
  end
174
+
175
+ def self.update(o)
176
+ discount = from_hash(o)
177
+ discount.update
178
+ end
179
+
180
+ # Create the node via the REST API
181
+ def update
182
+ megam_rest.update_discounts(to_hash)
183
+ end
170
184
 
171
185
  # Load all discounts -
172
186
  # returns a discountsCollection
@@ -147,8 +147,9 @@ module Megam
147
147
  # Show a particular promo by name,
148
148
  # Megam::Promos
149
149
  def self.show(params)
150
+ puts "[x] Called show"
150
151
  pre = self.new(params["email"], params["api_key"])
151
- pre.megam_rest.get_promos(params["email"])
152
+ pre.megam_rest.get_promos(params["code"])
152
153
  end
153
154
 
154
155
 
data/test/test_helper.rb CHANGED
@@ -69,9 +69,9 @@ def sandbox_name
69
69
  end
70
70
 
71
71
  def sandbox_apikey
72
- "er0zMGyO2-IN9VovVccYgA=="
72
+ "S2lTFprreumUrQPfjfKANQ=="
73
73
  end
74
74
 
75
75
  def sandbox_email
76
- "morpheyesh@gmail.com"
76
+ "super@removedtest.com"
77
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megam_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.52'
4
+ version: '0.53'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon