crystal_api 0.0.1 → 0.1.0

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: 27cacb6013a18cec21a77b3fe9b85ef9af918f80
4
- data.tar.gz: 2aacba745040e1048f1f584b92b45c0fe87af2ba
3
+ metadata.gz: 1486b8c1606697d61f0dde94837748c492c0a341
4
+ data.tar.gz: 6efb5c265690e4efa940316e7f87ed1af142a2eb
5
5
  SHA512:
6
- metadata.gz: 419ba56c0705c86cdf9fd9dd93a450f143deb3615c753cdc61f371f8b3ffd143e8dd3ef27bc5efd0f9e82bba03c359bbac87b248c5e9da9d689e05d29c51ebae
7
- data.tar.gz: 0891392e5ff703c08f30d9c422f2882567cc39b61234235e2faa53028ce892593c7cf7442868f44127985567aad82108c5494013b9c83b6f6e319245a7435b49
6
+ metadata.gz: 813c5df22c9ca2542c79676f6290d741d5d840ab0829a2d0e35b5c889050a159d92e463683cccc2d12ce680939389dd1f8f5d0055a29ad0f6a40c081edb4ff63
7
+ data.tar.gz: 417d08407ee3c43beff610aa7e817ec9e86d95baa57b8bdc239f74ecb2aa7e4a7a8ddced223701c62fbb3c643dc691de76c73cf271df63fffaf4da713c7c889a
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.name = "crystal_api"
8
8
  gem.version = CrystalApi::VERSION
9
9
  gem.authors = ["Donald Plummer"]
10
- gem.email = ["donald@crystalcommerce.com"]
10
+ gem.email = ["username@crystalcommerce.com"]
11
11
  gem.description = %q{A library for using the CrystalCommerce API.}
12
12
  gem.summary = %q{A library for using the CrystalCommerce API.}
13
13
  gem.homepage = "http://apidocs.crystalcommerce.com"
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency "money", "~> 5"
21
- gem.add_dependency "values", "~> 1.2.1"
20
+ gem.add_dependency "money"
21
+ gem.add_dependency "values"
22
22
  gem.add_dependency "activesupport"
23
23
  gem.add_dependency "httparty"
24
24
  gem.add_dependency "multi_json"
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
  gem.add_development_dependency 'rspec', '~> 2.11.0'
27
27
  gem.add_development_dependency 'guard', '~> 1.2.3'
28
28
  gem.add_development_dependency 'guard-rspec', '~> 1.2.1'
29
- gem.add_development_dependency 'vcr', '~> 2.2.4'
29
+ gem.add_development_dependency 'vcr', '~> 2.9'
30
30
  gem.add_development_dependency 'webmock', '~> 1.8.0'
31
31
  gem.add_development_dependency 'libnotify'
32
32
  gem.add_development_dependency 'rb-inotify', '~> 0.8.8'
@@ -4,7 +4,7 @@ require 'csv'
4
4
 
5
5
  module CrystalApi
6
6
  class StoreEndpoint
7
- attr_reader :base_url, :token
7
+ attr_reader :base_url, :username, :license
8
8
 
9
9
  class Response < Value.new(:success, :parsed, :raw, :json)
10
10
  alias_method :to_hash, :json
@@ -17,12 +17,12 @@ module CrystalApi
17
17
 
18
18
  def initialize(args = {})
19
19
  @base_url = args[:base_url]
20
- @token = args[:token]
20
+ @username = args[:username]
21
+ @license = args[:license]
21
22
  end
22
23
 
23
24
  def headers
24
25
  {
25
- "Authorization" => "OAuth #{token}",
26
26
  "Accept" => "application/json",
27
27
  "Content-Type" => "application/json",
28
28
  "X-Requested-With" => "XMLHttpRequest"
@@ -30,8 +30,14 @@ module CrystalApi
30
30
  end
31
31
 
32
32
  [:get, :delete, :post, :put].each do |method|
33
- define_method(method) do |*args|
34
- options = {:headers => headers}
33
+ define_method(method) do |*args, &block|
34
+ options = {
35
+ :headers => headers,
36
+ :basic_auth => {
37
+ :username => username,
38
+ :password => license
39
+ }
40
+ }
35
41
  if args.length == 2
36
42
  options[:body] = args[1].to_json
37
43
  end
@@ -39,8 +45,12 @@ module CrystalApi
39
45
  path = args[0]
40
46
  url = base_url + path
41
47
 
42
- raw = HTTParty.public_send(method, url, options)
43
- wrap_response(raw)
48
+ if block.nil?
49
+ raw = HTTParty.public_send(method, url, options)
50
+ wrap_response(raw)
51
+ else
52
+ HTTParty.public_send(method, url, options, &block)
53
+ end
44
54
  end
45
55
  end
46
56
 
@@ -1,3 +1,3 @@
1
1
  module CrystalApi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -2,66 +2,76 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://localhost:3000/api/v1/prefs/store
5
+ uri: https://username:licensekey@api.crystalcommerce.com/v1/stores/arux/prefs/store
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  Accept:
11
- - ! '*/*; q=0.5, application/xml'
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - OAuth TOKEN
16
- User-Agent:
17
- - Ruby
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ X-Requested-With:
15
+ - XMLHttpRequest
18
16
  response:
19
17
  status:
20
18
  code: 200
21
- message: ! 'OK '
19
+ message: OK
22
20
  headers:
23
- Etag:
24
- - ! '"62dbdcce719c67de7a0eee8d9e92ea2c"'
21
+ Server:
22
+ - nginx/1.6.0
23
+ Date:
24
+ - Sat, 24 May 2014 03:09:29 GMT
25
25
  Content-Type:
26
26
  - application/json; charset=utf-8
27
- Content-Md5:
28
- - 62dbdcce719c67de7a0eee8d9e92ea2c
27
+ Transfer-Encoding:
28
+ - chunked
29
29
  Connection:
30
- - Keep-Alive
31
- Server:
32
- - WEBrick/1.3.1 (Ruby/1.8.7/2012-02-08)
33
- X-Runtime:
34
- - '211'
30
+ - keep-alive
31
+ Status:
32
+ - '200'
33
+ X-Powered-By:
34
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.19
35
35
  Access-Control-Allow-Origin:
36
- - ! '*'
37
- Date:
38
- - Thu, 24 Jan 2013 04:45:30 GMT
39
- Cache-Control:
40
- - private, max-age=0, must-revalidate
41
- Content-Length:
42
- - '2498'
43
- Access-Control-Expose-Headers:
44
- - content-type, content-md5, x-oauth-scopes, x-accepted-oauth-scopes, content-length,
45
- cache-control
46
- Access-Control-Allow-Methods:
47
- - GET, POST, PUT, DELETE, OPTIONS
36
+ - "*"
48
37
  Access-Control-Allow-Headers:
49
38
  - origin, authorization, content-type, accept
50
- Set-Cookie:
51
- - _admin_session=d7405de32bc2300e951a253d069ad71d; path=/; expires=Fri, 25-Jan-2013
52
- 00:45:30 GMT; HttpOnly
39
+ Access-Control-Allow-Methods:
40
+ - GET, POST, PUT, DELETE, OPTIONS
41
+ Access-Control-Expose-Headers:
42
+ - content-type, content-md5, x-your-scopes, x-accepted-api-scopes, x-your-scopes-after-impersonation,
43
+ content-length, cache-control
44
+ X-Required-Api-Scopes:
45
+ - admin:read-store-prefs
46
+ X-Your-Scopes:
47
+ - admin:read-inventory admin:read-buy-orders admin:read-customers admin:read-orders
48
+ admin:read-pages admin:read-store-prefs admin:read-store-locations admin:read-users
49
+ Content-Md5:
50
+ - db59e0d88605bf87d70952fd225585fa
51
+ X-Ua-Compatible:
52
+ - IE=Edge,chrome=1
53
+ Etag:
54
+ - '"db59e0d88605bf87d70952fd225585fa"'
55
+ Cache-Control:
56
+ - must-revalidate, private, max-age=0
57
+ X-Request-Id:
58
+ - f1a59096eca7b6369248475e86e90976
59
+ X-Runtime:
60
+ - '0.096830'
61
+ X-Rack-Cache:
62
+ - miss
63
+ X-Server-Name:
64
+ - new-app03.c44959.blueboxgrid.com
53
65
  body:
54
- encoding: US-ASCII
55
- string: ! '{"store_prefs":{"buylist_email":"donald@crystalcommerce.com","satisfaction_blurb":"Our
56
- #1 goal is making sure you''re happy with your purchase today. Happy customers
57
- come back soon and tell their friends. Its a win, win.","enable_frontend_auto_translate":false,"logo_photo":{"photo":{"is_default":false,"urls":{"large":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/large/arux-banner.png"},"medium":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/medium/arux-banner.png"},"original":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/arux-banner.png"},"huge":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/huge/arux-banner.png"},"thumb":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/thumb/arux-banner.png"}}}},"return_blurb":"If
58
- your order ever arrives in less than expected condition, please promptly return
59
- it to us for a full refund. We take your business with us very seriously.","time_zone":"Pacific
60
- Time (US & Canada)","city":"Seattle","hostname":"store.arux.net","customer_service_phone":"555-555-5555","zip":"98125","sales_tax":"9","cancel":"14","default_currency_code":"USD","default_locale":"x-bork","privacy_blurb":"We
61
- promise to never ever sell your personal private information to any 3rd party
62
- company! We hate spam too. Order today with confidence.","enable_manual_credit_card_capture":false,"store_credit_multiplier":"1.3","buylist_cancel_days":"0","checkout_special_instructions":"","default_exchange_rate":"1","enable_buy_order_notifications":"1","enable_buylist":true,"enable_bcc_buylist_confirmation_emails":false,"enable_tax_on_shipping":true,"enable_sort_by_price":true,"feedback_timespan":"14","home_redirect":"/catalog/magic_singles-core_sets-magic_2012/306","phone":"555-555-5555","state":"WA","enable_referafriend":true,"address":"3400
63
- NE 110th ST #B-1","payment":"7","contact_name":"Mr. Arux","name":"Arux Gaming
64
- and Hobbies","display_customer_service_phone":false,"enable_order_notifications":"1","enable_account_approval":false,"enable_watermarking_of_product_photos":false,"watermark_photo":null,"country":"US","contact_email":"donald@crystalcommerce.com","buylist_reminder_days":"0","hide_bank_transfer_details_in_emails":false,"enable_invoice_logo":false}}'
66
+ encoding: UTF-8
67
+ string: '{"store_prefs":{"enable_invoice_logo":false,"enable_sort_by_price":true,"enable_tax_on_shipping":true,"enable_tax_all_orders":false,"display_customer_service_phone":false,"enable_frontend_auto_translate":true,"enable_bcc_buylist_confirmation_emails":false,"enable_watermarking_of_product_photos":true,"enable_account_approval":false,"enable_manual_credit_card_capture":false,"hide_bank_transfer_details_in_emails":false,"enable_buylist":true,"enable_referafriend":true,"enable_order_notifications":"1","enable_buy_order_notifications":"1","privacy_blurb":"WE''RE
68
+ NOT A REAL STORE. DON''T BUY FROM US.","satisfaction_blurb":"WE''RE NOT A
69
+ REAL STORE. DON''T BUY FROM US.","return_blurb":"WE''RE NOT A REAL STORE.
70
+ DON''T BUY FROM US.","customer_service_phone":"555-555-5555","default_locale":"en","default_currency_code":"USD","default_exchange_rate":"1","checkout_special_instructions":"WE''RE
71
+ NOT A REAL STORE. DON''T BUY FROM US.","payment":"7","cancel":"14","buylist_reminder_days":"0","buylist_cancel_days":"0","store_credit_multiplier":"1.3","name":"Arux
72
+ Gaming and Hobbies","contact_name":"Mr. Arux","contact_email":"username@crystalcommerce.com","buylist_email":"username@crystalcommerce.com","hostname":"store.arux.net","sales_tax":"9","address":"3400
73
+ NE 110th ST #B-1","city":"Seattle","state":"WA","zip":"98125","phone":"555-555-5555","country":"US","home_redirect":"/catalog/magic_singles-core_sets-magic_2012/306","feedback_timespan":"0","time_zone":"Pacific
74
+ Time (US & Canada)","logo_photo":{"photo":{"urls":{"original":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/arux-banner.png"},"huge":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/huge/arux-banner.png"},"large":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/large/arux-banner.png"},"medium":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/medium/arux-banner.png"},"thumb":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/thumb/arux-banner.png"},"ebay":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/ebay/arux-banner.png"}},"is_default":false}},"watermark_photo":{"photo":{"urls":{"original":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/761c2fb2fb1458d563c49bf9c2a1632a/blue-eye-lofi.png"}},"is_default":false}}}}'
65
75
  http_version:
66
- recorded_at: Thu, 24 Jan 2013 04:45:30 GMT
67
- recorded_with: VCR 2.2.4
76
+ recorded_at: Sat, 24 May 2014 03:09:28 GMT
77
+ recorded_with: VCR 2.9.1
@@ -2,66 +2,76 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://localhost:3000/api/v1/prefs/store
5
+ uri: https://username:licensekey@api.crystalcommerce.com/v1/stores/arux/prefs/store
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  Accept:
11
- - ! '*/*; q=0.5, application/xml'
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - OAuth TOKEN
16
- User-Agent:
17
- - Ruby
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ X-Requested-With:
15
+ - XMLHttpRequest
18
16
  response:
19
17
  status:
20
18
  code: 200
21
- message: ! 'OK '
19
+ message: OK
22
20
  headers:
23
- Etag:
24
- - ! '"62dbdcce719c67de7a0eee8d9e92ea2c"'
21
+ Server:
22
+ - nginx/1.6.0
23
+ Date:
24
+ - Sat, 24 May 2014 03:09:29 GMT
25
25
  Content-Type:
26
26
  - application/json; charset=utf-8
27
- Content-Md5:
28
- - 62dbdcce719c67de7a0eee8d9e92ea2c
27
+ Transfer-Encoding:
28
+ - chunked
29
29
  Connection:
30
- - Keep-Alive
31
- Server:
32
- - WEBrick/1.3.1 (Ruby/1.8.7/2012-02-08)
33
- X-Runtime:
34
- - '64'
30
+ - keep-alive
31
+ Status:
32
+ - '200'
33
+ X-Powered-By:
34
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.19
35
35
  Access-Control-Allow-Origin:
36
- - ! '*'
37
- Date:
38
- - Thu, 24 Jan 2013 05:14:11 GMT
39
- Cache-Control:
40
- - private, max-age=0, must-revalidate
41
- Content-Length:
42
- - '2498'
43
- Access-Control-Expose-Headers:
44
- - content-type, content-md5, x-oauth-scopes, x-accepted-oauth-scopes, content-length,
45
- cache-control
46
- Access-Control-Allow-Methods:
47
- - GET, POST, PUT, DELETE, OPTIONS
36
+ - "*"
48
37
  Access-Control-Allow-Headers:
49
38
  - origin, authorization, content-type, accept
50
- Set-Cookie:
51
- - _admin_session=d989077369170dfdbfee1b5607371d27; path=/; expires=Fri, 25-Jan-2013
52
- 01:14:11 GMT; HttpOnly
39
+ Access-Control-Allow-Methods:
40
+ - GET, POST, PUT, DELETE, OPTIONS
41
+ Access-Control-Expose-Headers:
42
+ - content-type, content-md5, x-your-scopes, x-accepted-api-scopes, x-your-scopes-after-impersonation,
43
+ content-length, cache-control
44
+ X-Required-Api-Scopes:
45
+ - admin:read-store-prefs
46
+ X-Your-Scopes:
47
+ - admin:read-inventory admin:read-buy-orders admin:read-customers admin:read-orders
48
+ admin:read-pages admin:read-store-prefs admin:read-store-locations admin:read-users
49
+ Content-Md5:
50
+ - db59e0d88605bf87d70952fd225585fa
51
+ X-Ua-Compatible:
52
+ - IE=Edge,chrome=1
53
+ Etag:
54
+ - '"db59e0d88605bf87d70952fd225585fa"'
55
+ Cache-Control:
56
+ - must-revalidate, private, max-age=0
57
+ X-Request-Id:
58
+ - c8172fdd3dd3ccb1cef3510768c87595
59
+ X-Runtime:
60
+ - '0.060800'
61
+ X-Rack-Cache:
62
+ - miss
63
+ X-Server-Name:
64
+ - new-app03.c44959.blueboxgrid.com
53
65
  body:
54
- encoding: US-ASCII
55
- string: ! '{"store_prefs":{"buylist_email":"donald@crystalcommerce.com","satisfaction_blurb":"Our
56
- #1 goal is making sure you''re happy with your purchase today. Happy customers
57
- come back soon and tell their friends. Its a win, win.","enable_frontend_auto_translate":false,"logo_photo":{"photo":{"is_default":false,"urls":{"large":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/large/arux-banner.png"},"medium":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/medium/arux-banner.png"},"original":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/arux-banner.png"},"huge":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/huge/arux-banner.png"},"thumb":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/thumb/arux-banner.png"}}}},"return_blurb":"If
58
- your order ever arrives in less than expected condition, please promptly return
59
- it to us for a full refund. We take your business with us very seriously.","time_zone":"Pacific
60
- Time (US & Canada)","city":"Seattle","hostname":"store.arux.net","customer_service_phone":"555-555-5555","zip":"98125","sales_tax":"9","cancel":"14","default_currency_code":"USD","default_locale":"x-bork","privacy_blurb":"We
61
- promise to never ever sell your personal private information to any 3rd party
62
- company! We hate spam too. Order today with confidence.","enable_manual_credit_card_capture":false,"store_credit_multiplier":"1.3","buylist_cancel_days":"0","checkout_special_instructions":"","default_exchange_rate":"1","enable_buy_order_notifications":"1","enable_buylist":true,"enable_bcc_buylist_confirmation_emails":false,"enable_tax_on_shipping":true,"enable_sort_by_price":true,"feedback_timespan":"14","home_redirect":"/catalog/magic_singles-core_sets-magic_2012/306","phone":"555-555-5555","state":"WA","enable_referafriend":true,"address":"3400
63
- NE 110th ST #B-1","payment":"7","contact_name":"Mr. Arux","name":"Arux Gaming
64
- and Hobbies","display_customer_service_phone":false,"enable_order_notifications":"1","enable_account_approval":false,"enable_watermarking_of_product_photos":false,"watermark_photo":null,"country":"US","contact_email":"donald@crystalcommerce.com","buylist_reminder_days":"0","hide_bank_transfer_details_in_emails":false,"enable_invoice_logo":false}}'
66
+ encoding: UTF-8
67
+ string: '{"store_prefs":{"enable_invoice_logo":false,"enable_sort_by_price":true,"enable_tax_on_shipping":true,"enable_tax_all_orders":false,"display_customer_service_phone":false,"enable_frontend_auto_translate":true,"enable_bcc_buylist_confirmation_emails":false,"enable_watermarking_of_product_photos":true,"enable_account_approval":false,"enable_manual_credit_card_capture":false,"hide_bank_transfer_details_in_emails":false,"enable_buylist":true,"enable_referafriend":true,"enable_order_notifications":"1","enable_buy_order_notifications":"1","privacy_blurb":"WE''RE
68
+ NOT A REAL STORE. DON''T BUY FROM US.","satisfaction_blurb":"WE''RE NOT A
69
+ REAL STORE. DON''T BUY FROM US.","return_blurb":"WE''RE NOT A REAL STORE.
70
+ DON''T BUY FROM US.","customer_service_phone":"555-555-5555","default_locale":"en","default_currency_code":"USD","default_exchange_rate":"1","checkout_special_instructions":"WE''RE
71
+ NOT A REAL STORE. DON''T BUY FROM US.","payment":"7","cancel":"14","buylist_reminder_days":"0","buylist_cancel_days":"0","store_credit_multiplier":"1.3","name":"Arux
72
+ Gaming and Hobbies","contact_name":"Mr. Arux","contact_email":"username@crystalcommerce.com","buylist_email":"username@crystalcommerce.com","hostname":"store.arux.net","sales_tax":"9","address":"3400
73
+ NE 110th ST #B-1","city":"Seattle","state":"WA","zip":"98125","phone":"555-555-5555","country":"US","home_redirect":"/catalog/magic_singles-core_sets-magic_2012/306","feedback_timespan":"0","time_zone":"Pacific
74
+ Time (US & Canada)","logo_photo":{"photo":{"urls":{"original":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/arux-banner.png"},"huge":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/huge/arux-banner.png"},"large":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/large/arux-banner.png"},"medium":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/medium/arux-banner.png"},"thumb":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/thumb/arux-banner.png"},"ebay":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/2c5be8d8add29ab3e6c0e2e1ad55732d/ebay/arux-banner.png"}},"is_default":false}},"watermark_photo":{"photo":{"urls":{"original":{"href":"http://client-cdn.crystalcommerce.com/photo/arux/file/761c2fb2fb1458d563c49bf9c2a1632a/blue-eye-lofi.png"}},"is_default":false}}}}'
65
75
  http_version:
66
- recorded_at: Thu, 24 Jan 2013 05:14:11 GMT
67
- recorded_with: VCR 2.2.4
76
+ recorded_at: Sat, 24 May 2014 03:09:29 GMT
77
+ recorded_with: VCR 2.9.1
@@ -1,18 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CrystalApi::StoreEndpoint do
4
- subject { CrystalApi::StoreEndpoint.new(base_url: "http://localhost:3000/api/v1",
5
- token: "TOKEN") }
4
+ let(:user) { 'username' }
5
+ let(:pass) { 'licensekey' }
6
+ subject { CrystalApi::StoreEndpoint.new(base_url: "https://api.crystalcommerce.com/v1/stores/arux",
7
+ username: user,
8
+ license: pass) }
6
9
 
7
- its(:base_url) { should == "http://localhost:3000/api/v1" }
8
- its(:token) { should == "TOKEN" }
9
- its(:headers) { should include("Authorization" => "OAuth TOKEN") }
10
+ it "requests and accepts json" do
11
+ expect(subject.headers).to include({
12
+ "Accept" => "application/json",
13
+ "Content-Type" => "application/json",
14
+ })
15
+ end
10
16
 
11
17
  describe "#get" do
12
18
  context "/prefs/store", :vcr do
13
19
  it "makes the request to the endpoint" do
14
20
  subject.get("/prefs/store")
15
- a_request(:get, "http://localhost:3000/api/v1/prefs/store").
21
+ a_request(:get, "https://#{user}:#{pass}@api.crystalcommerce.com/v1/stores/arux/prefs/store").
16
22
  should have_been_made
17
23
  end
18
24
 
@@ -23,7 +29,7 @@ describe CrystalApi::StoreEndpoint do
23
29
 
24
30
  context "csv parsing" do
25
31
  before do
26
- stub_request(:get, "http://localhost:3000/api/v1/reports/1234/download").
32
+ stub_request(:get, "https://#{user}:#{pass}@api.crystalcommerce.com/v1/stores/arux/reports/1234/download").
27
33
  to_return(:body => "id,name\n1,Fred",
28
34
  :headers => {:content_type => "text/csv"})
29
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crystal_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Plummer
@@ -14,30 +14,30 @@ dependencies:
14
14
  name: money
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: values
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.1
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.1
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 2.2.4
131
+ version: '2.9'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 2.2.4
138
+ version: '2.9'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: webmock
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ dependencies:
194
194
  version: '0'
195
195
  description: A library for using the CrystalCommerce API.
196
196
  email:
197
- - donald@crystalcommerce.com
197
+ - username@crystalcommerce.com
198
198
  executables: []
199
199
  extensions: []
200
200
  extra_rdoc_files: []
@@ -236,7 +236,6 @@ files:
236
236
  - lib/crystal_api/webhook_verifier.rb
237
237
  - spec/cassettes/CrystalApi_StoreEndpoint/_get/prefs/store/makes_the_request_to_the_endpoint.yml
238
238
  - spec/cassettes/CrystalApi_StoreEndpoint/_get/prefs/store/parses_the_returned_a_store_pref.yml
239
- - spec/cassettes/CrystalApi_StoreEndpoint/_get/prefs/store/returns_a_store_pref_instance.yml
240
239
  - spec/crystal_api/attributes_spec.rb
241
240
  - spec/crystal_api/category_spec.rb
242
241
  - spec/crystal_api/money_spec.rb
@@ -282,7 +281,6 @@ summary: A library for using the CrystalCommerce API.
282
281
  test_files:
283
282
  - spec/cassettes/CrystalApi_StoreEndpoint/_get/prefs/store/makes_the_request_to_the_endpoint.yml
284
283
  - spec/cassettes/CrystalApi_StoreEndpoint/_get/prefs/store/parses_the_returned_a_store_pref.yml
285
- - spec/cassettes/CrystalApi_StoreEndpoint/_get/prefs/store/returns_a_store_pref_instance.yml
286
284
  - spec/crystal_api/attributes_spec.rb
287
285
  - spec/crystal_api/category_spec.rb
288
286
  - spec/crystal_api/money_spec.rb
@@ -1,67 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://localhost:3000/api/v1/prefs/store
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - ! '*/*; q=0.5, application/xml'
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - OAuth TOKEN
16
- User-Agent:
17
- - Ruby
18
- response:
19
- status:
20
- code: 200
21
- message: ! 'OK '
22
- headers:
23
- Etag:
24
- - ! '"62dbdcce719c67de7a0eee8d9e92ea2c"'
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Content-Md5:
28
- - 62dbdcce719c67de7a0eee8d9e92ea2c
29
- Connection:
30
- - Keep-Alive
31
- Server:
32
- - WEBrick/1.3.1 (Ruby/1.8.7/2012-02-08)
33
- X-Runtime:
34
- - '58'
35
- Access-Control-Allow-Origin:
36
- - ! '*'
37
- Date:
38
- - Thu, 24 Jan 2013 04:47:04 GMT
39
- Cache-Control:
40
- - private, max-age=0, must-revalidate
41
- Content-Length:
42
- - '2498'
43
- Access-Control-Expose-Headers:
44
- - content-type, content-md5, x-oauth-scopes, x-accepted-oauth-scopes, content-length,
45
- cache-control
46
- Access-Control-Allow-Methods:
47
- - GET, POST, PUT, DELETE, OPTIONS
48
- Access-Control-Allow-Headers:
49
- - origin, authorization, content-type, accept
50
- Set-Cookie:
51
- - _admin_session=ebb621b076e457c5da22fb012b437686; path=/; expires=Fri, 25-Jan-2013
52
- 00:47:04 GMT; HttpOnly
53
- body:
54
- encoding: US-ASCII
55
- string: ! '{"store_prefs":{"buylist_email":"donald@crystalcommerce.com","satisfaction_blurb":"Our
56
- #1 goal is making sure you''re happy with your purchase today. Happy customers
57
- come back soon and tell their friends. Its a win, win.","enable_frontend_auto_translate":false,"logo_photo":{"photo":{"is_default":false,"urls":{"large":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/large/arux-banner.png"},"medium":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/medium/arux-banner.png"},"original":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/arux-banner.png"},"huge":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/huge/arux-banner.png"},"thumb":{"href":"http://crystalcommerce-development.s3.amazonaws.com/photo/arux/file/8e233b1f3da489341a9d55a1ca744556/thumb/arux-banner.png"}}}},"return_blurb":"If
58
- your order ever arrives in less than expected condition, please promptly return
59
- it to us for a full refund. We take your business with us very seriously.","time_zone":"Pacific
60
- Time (US & Canada)","city":"Seattle","hostname":"store.arux.net","customer_service_phone":"555-555-5555","zip":"98125","sales_tax":"9","cancel":"14","default_currency_code":"USD","default_locale":"x-bork","privacy_blurb":"We
61
- promise to never ever sell your personal private information to any 3rd party
62
- company! We hate spam too. Order today with confidence.","enable_manual_credit_card_capture":false,"store_credit_multiplier":"1.3","buylist_cancel_days":"0","checkout_special_instructions":"","default_exchange_rate":"1","enable_buy_order_notifications":"1","enable_buylist":true,"enable_bcc_buylist_confirmation_emails":false,"enable_tax_on_shipping":true,"enable_sort_by_price":true,"feedback_timespan":"14","home_redirect":"/catalog/magic_singles-core_sets-magic_2012/306","phone":"555-555-5555","state":"WA","enable_referafriend":true,"address":"3400
63
- NE 110th ST #B-1","payment":"7","contact_name":"Mr. Arux","name":"Arux Gaming
64
- and Hobbies","display_customer_service_phone":false,"enable_order_notifications":"1","enable_account_approval":false,"enable_watermarking_of_product_photos":false,"watermark_photo":null,"country":"US","contact_email":"donald@crystalcommerce.com","buylist_reminder_days":"0","hide_bank_transfer_details_in_emails":false,"enable_invoice_logo":false}}'
65
- http_version:
66
- recorded_at: Thu, 24 Jan 2013 04:47:04 GMT
67
- recorded_with: VCR 2.2.4