cardmagic-etsy 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/etsy.gemspec +1 -1
- data/lib/etsy/bill_charge.rb +31 -0
- data/lib/etsy/bill_payment.rb +28 -0
- data/lib/etsy/billing_overview.rb +18 -0
- data/lib/etsy/shipping_info.rb +2 -2
- data/lib/etsy/version.rb +1 -1
- data/lib/etsy.rb +3 -0
- data/test/fixtures/bill_charge/getBillCharge.json +1 -0
- data/test/fixtures/bill_payment/getBillPayment.json +1 -0
- data/test/fixtures/billing_overview/getBillingOverview.json +1 -0
- data/test/unit/etsy/bill_charge_test.rb +24 -0
- data/test/unit/etsy/bill_payment_test.rb +24 -0
- data/test/unit/etsy/billing_overview_test.rb +20 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54fe363772c315079279cbf2634bc060d11ffcb3eaff81fe45c248eee43a1e5b
|
4
|
+
data.tar.gz: e06934f7865228d73981791ab5a1c931062627ce42c549b46466b3ccc401d609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf3b87cebfd12638a9842e0fe562906dd0504bcfd2c5e837bf75c281439de78e9bc648f0eafd2a18db30b9a6034c627076021a3348cfbe6b775dd134e0a86d28
|
7
|
+
data.tar.gz: e69eda5a45f3aa0bebe0a8e904a31ae831d71d1b9444b03a6898538942020b103f6537660fbe1a42bf2ddb8ebe34a98ec0be62f0fe564c0095b49c56db0501ad
|
data/etsy.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
-
gem.name = "
|
14
|
+
gem.name = "etsy"
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Etsy::VERSION
|
17
17
|
gem.license = 'MIT'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Etsy
|
2
|
+
|
3
|
+
# = BillCharge
|
4
|
+
#
|
5
|
+
# Represents a charge to an Etsy member's account.
|
6
|
+
#
|
7
|
+
#
|
8
|
+
class BillCharge
|
9
|
+
|
10
|
+
include Etsy::Model
|
11
|
+
|
12
|
+
attribute :id, :from => :bill_charge_id
|
13
|
+
attribute :created, :from => :creation_tsz
|
14
|
+
attribute :last_modified, :from => :last_modified_tsz
|
15
|
+
|
16
|
+
attributes :type, :type_id, :user_id, :amount, :currency_code, :creation_month,
|
17
|
+
:creation_year
|
18
|
+
|
19
|
+
def self.find_all_by_user_id(user_id, options = {})
|
20
|
+
get_all("/users/#{user_id}/charges", options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def created_at
|
24
|
+
Time.at(created)
|
25
|
+
end
|
26
|
+
|
27
|
+
def last_modified_at
|
28
|
+
Time.at(last_modified)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Etsy
|
2
|
+
|
3
|
+
# = BillPayment
|
4
|
+
#
|
5
|
+
# Represents a user's Billing Payment.
|
6
|
+
#
|
7
|
+
#
|
8
|
+
class BillPayment
|
9
|
+
|
10
|
+
include Etsy::Model
|
11
|
+
|
12
|
+
attribute :id, :from => :bill_payment_id
|
13
|
+
attribute :created, :from => :creation_tsz
|
14
|
+
|
15
|
+
attributes :type, :type_id, :user_id, :amount, :currency_code, :creation_month,
|
16
|
+
:creation_year
|
17
|
+
|
18
|
+
def self.find_all_by_user_id(user_id, options = {})
|
19
|
+
get_all("/users/#{user_id}/payments", options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Time that this listing was created
|
23
|
+
#
|
24
|
+
def created_at
|
25
|
+
Time.at(created)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Etsy
|
2
|
+
|
3
|
+
# = BillingOverview
|
4
|
+
#
|
5
|
+
# A user's account balance on Etsy.
|
6
|
+
#
|
7
|
+
class BillingOverview
|
8
|
+
|
9
|
+
include Etsy::Model
|
10
|
+
|
11
|
+
attributes :is_overdue, :overdue_balance, :balance_due, :total_balance, :currency_code, :date_due,
|
12
|
+
:creation_year
|
13
|
+
|
14
|
+
def self.find_all_by_user_id(user_id, options = {})
|
15
|
+
get_all("/users/#{user_id}/billing/overview", options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/etsy/shipping_info.rb
CHANGED
@@ -15,13 +15,13 @@ module Etsy
|
|
15
15
|
get("/shipping/info/#{id}", options)
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.
|
18
|
+
def self.find_all_by_listing_id(listing_id, credentials = {})
|
19
19
|
options = {
|
20
20
|
:access_token => credentials[:access_token],
|
21
21
|
:access_secret => credentials[:access_secret],
|
22
22
|
:require_secure => true
|
23
23
|
}
|
24
|
-
|
24
|
+
get_all("/listings/#{listing_id}/shipping/info", options)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/etsy/version.rb
CHANGED
data/lib/etsy.rb
CHANGED
@@ -15,6 +15,9 @@ require 'etsy/verification_request'
|
|
15
15
|
require 'etsy/model'
|
16
16
|
require 'etsy/user'
|
17
17
|
require 'etsy/profile'
|
18
|
+
require 'etsy/bill_charge'
|
19
|
+
require 'etsy/bill_payment'
|
20
|
+
require 'etsy/billing_overview'
|
18
21
|
require 'etsy/shop'
|
19
22
|
require 'etsy/listing'
|
20
23
|
require 'etsy/attribute_value'
|
@@ -0,0 +1 @@
|
|
1
|
+
{"count":1,"results":[{"bill_charge_id":212,"type":"listing_id","type_id":14888443,"amount":"3.00"}],"params":{"user_id":"212"},"type":"BillCharge","pagination":{}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"count":1,"results":[{"bill_payment_id":212,"type":"listing_id","type_id":14888443,"amount":"3.00"}],"params":{"user_id":"212"},"type":"BillPayment","pagination":{}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"count":1,"results":[{"total_balance":1399,"balance_due":999}],"params":{"user_id":"212"},"type":"BillingOverview","pagination":{}}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Etsy
|
4
|
+
class BillChargeTest < Test::Unit::TestCase
|
5
|
+
context "An instance of the BillCharge class" do
|
6
|
+
setup do
|
7
|
+
data = read_fixture('bill_charge/getBillCharge.json')
|
8
|
+
@bill_charge = BillCharge.new(data.first)
|
9
|
+
end
|
10
|
+
|
11
|
+
should "have an id" do
|
12
|
+
@bill_charge.id.should == 212
|
13
|
+
end
|
14
|
+
|
15
|
+
should "have a type" do
|
16
|
+
@bill_charge.type.should == "listing_id"
|
17
|
+
end
|
18
|
+
|
19
|
+
should "have an type_id" do
|
20
|
+
@bill_charge.type_id.should == 14888443
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Etsy
|
4
|
+
class BillPaymentTest < Test::Unit::TestCase
|
5
|
+
context "An instance of the BillPayment class" do
|
6
|
+
setup do
|
7
|
+
data = read_fixture('bill_payment/getBillPayment.json')
|
8
|
+
@bill_payment = BillPayment.new(data.first)
|
9
|
+
end
|
10
|
+
|
11
|
+
should "have an id" do
|
12
|
+
@bill_payment.id.should == 212
|
13
|
+
end
|
14
|
+
|
15
|
+
should "have a type" do
|
16
|
+
@bill_payment.type.should == "listing_id"
|
17
|
+
end
|
18
|
+
|
19
|
+
should "have an type_id" do
|
20
|
+
@bill_payment.type_id.should == 14888443
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Etsy
|
4
|
+
class BillingOverviewTest < Test::Unit::TestCase
|
5
|
+
context "An instance of the BillingOverview class" do
|
6
|
+
setup do
|
7
|
+
data = read_fixture('billing_overview/getBillingOverview.json')
|
8
|
+
@billing_overview = BillingOverview.new(data.first)
|
9
|
+
end
|
10
|
+
|
11
|
+
should "have a total_balance" do
|
12
|
+
@billing_overview.total_balance.should == 1399
|
13
|
+
end
|
14
|
+
|
15
|
+
should "have a balance_due" do
|
16
|
+
@billing_overview.balance_due.should == 999
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardmagic-etsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Reagan
|
@@ -129,6 +129,9 @@ files:
|
|
129
129
|
- lib/etsy/address.rb
|
130
130
|
- lib/etsy/attribute_value.rb
|
131
131
|
- lib/etsy/basic_client.rb
|
132
|
+
- lib/etsy/bill_charge.rb
|
133
|
+
- lib/etsy/bill_payment.rb
|
134
|
+
- lib/etsy/billing_overview.rb
|
132
135
|
- lib/etsy/category.rb
|
133
136
|
- lib/etsy/country.rb
|
134
137
|
- lib/etsy/favorite_listing.rb
|
@@ -153,6 +156,9 @@ files:
|
|
153
156
|
- test/fixtures/about/getAbout.json
|
154
157
|
- test/fixtures/address/getUserAddresses.json
|
155
158
|
- test/fixtures/attribute_value/findAllListingPropertyValues.json
|
159
|
+
- test/fixtures/bill_charge/getBillCharge.json
|
160
|
+
- test/fixtures/bill_payment/getBillPayment.json
|
161
|
+
- test/fixtures/billing_overview/getBillingOverview.json
|
156
162
|
- test/fixtures/category/findAllSubCategoryChildren.json
|
157
163
|
- test/fixtures/category/findAllTopCategory.json
|
158
164
|
- test/fixtures/category/findAllTopCategory.single.json
|
@@ -187,6 +193,9 @@ files:
|
|
187
193
|
- test/unit/etsy/address_test.rb
|
188
194
|
- test/unit/etsy/attribute_value_test.rb
|
189
195
|
- test/unit/etsy/basic_client_test.rb
|
196
|
+
- test/unit/etsy/bill_charge_test.rb
|
197
|
+
- test/unit/etsy/bill_payment_test.rb
|
198
|
+
- test/unit/etsy/billing_overview_test.rb
|
190
199
|
- test/unit/etsy/category_test.rb
|
191
200
|
- test/unit/etsy/country_test.rb
|
192
201
|
- test/unit/etsy/favorite_listing_test.rb
|
@@ -236,6 +245,9 @@ test_files:
|
|
236
245
|
- test/fixtures/about/getAbout.json
|
237
246
|
- test/fixtures/address/getUserAddresses.json
|
238
247
|
- test/fixtures/attribute_value/findAllListingPropertyValues.json
|
248
|
+
- test/fixtures/bill_charge/getBillCharge.json
|
249
|
+
- test/fixtures/bill_payment/getBillPayment.json
|
250
|
+
- test/fixtures/billing_overview/getBillingOverview.json
|
239
251
|
- test/fixtures/category/findAllSubCategoryChildren.json
|
240
252
|
- test/fixtures/category/findAllTopCategory.json
|
241
253
|
- test/fixtures/category/findAllTopCategory.single.json
|
@@ -270,6 +282,9 @@ test_files:
|
|
270
282
|
- test/unit/etsy/address_test.rb
|
271
283
|
- test/unit/etsy/attribute_value_test.rb
|
272
284
|
- test/unit/etsy/basic_client_test.rb
|
285
|
+
- test/unit/etsy/bill_charge_test.rb
|
286
|
+
- test/unit/etsy/bill_payment_test.rb
|
287
|
+
- test/unit/etsy/billing_overview_test.rb
|
273
288
|
- test/unit/etsy/category_test.rb
|
274
289
|
- test/unit/etsy/country_test.rb
|
275
290
|
- test/unit/etsy/favorite_listing_test.rb
|