gmo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +22 -0
  3. data/README.ja.md +54 -0
  4. data/README.md +54 -0
  5. data/Rakefile +15 -0
  6. data/autotest/discover.rb +1 -0
  7. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_change_order_auth_to_sale.yml +90 -0
  8. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_gets_data_about_order.yml +90 -0
  9. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_got_error_if_missing_options.yml +32 -0
  10. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_gets_data_about_order.yml +90 -0
  11. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_got_error_if_missing_options.yml +32 -0
  12. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml +32 -0
  13. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml +32 -0
  14. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml +32 -0
  15. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml +32 -0
  16. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_gets_data_about_order.yml +32 -0
  17. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_got_error_if_missing_options.yml +32 -0
  18. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_gets_data_about_order.yml +34 -0
  19. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_got_error_if_missing_options.yml +34 -0
  20. data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_error_if_missing_options.yml +32 -0
  21. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_card_gets_data_about_a_card.yml +34 -0
  22. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_member_gets_data_about_a_member.yml +34 -0
  23. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_gets_data_about_a_card.yml +34 -0
  24. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_gets_data_about_a_transaction.yml +32 -0
  25. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_got_error_if_missing_options.yml +32 -0
  26. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_gets_data_about_a_card.yml +65 -0
  27. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_member_gets_data_about_a_member.yml +65 -0
  28. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_update_member_gets_data_about_a_transaction.yml +32 -0
  29. data/gmo.gemspec +30 -0
  30. data/lib/gmo.rb +99 -0
  31. data/lib/gmo/errors.rb +51 -0
  32. data/lib/gmo/http_services.rb +77 -0
  33. data/lib/gmo/shop_and_site_api.rb +56 -0
  34. data/lib/gmo/shop_api.rb +218 -0
  35. data/lib/gmo/site_api.rb +146 -0
  36. data/lib/gmo/version.rb +3 -0
  37. data/spec/gmo/api_spec.rb +32 -0
  38. data/spec/gmo/error_spec.rb +25 -0
  39. data/spec/gmo/http_service_spec.rb +23 -0
  40. data/spec/gmo/shop_and_site_api_spec.rb +45 -0
  41. data/spec/gmo/shop_api_spec.rb +261 -0
  42. data/spec/gmo/site_api_spec.rb +140 -0
  43. data/spec/spec_helper.rb +21 -0
  44. data/spec/support/config.example.yml +4 -0
  45. data/spec/support/config.yml +4 -0
  46. data/spec/support/config_loader.rb +2 -0
  47. data/spec/support/factory.rb +8 -0
  48. data/spec/support/vcr.rb +21 -0
  49. data/travis.yml +11 -0
  50. metadata +202 -0
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'Although not required, bundler is recommended for running the tests.'
5
+ end
6
+ # load the library
7
+ require "simplecov"
8
+ SimpleCov.start
9
+ require 'gmo'
10
+ require 'rspec'
11
+ require 'vcr'
12
+ require 'support/config_loader'
13
+ require 'support/factory'
14
+ require 'support/vcr'
15
+
16
+ RSpec.configure do |config|
17
+ config.mock_with :rspec
18
+ config.treat_symbols_as_metadata_keys_with_true_values = true
19
+ config.filter_run :focus => true
20
+ config.run_all_when_everything_filtered = true
21
+ end
@@ -0,0 +1,4 @@
1
+ shop_id: tshophoge
2
+ shop_pass: hoge
3
+ site_id: tsitehoge
4
+ site_pass: hoge
@@ -0,0 +1,4 @@
1
+ shop_id: tshop0001
2
+ shop_pass: 1
3
+ site_id: tsite0001
4
+ site_pass: 1
@@ -0,0 +1,2 @@
1
+ require 'yaml'
2
+ SPEC_CONF = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))
@@ -0,0 +1,8 @@
1
+ require 'digest/md5'
2
+
3
+ def generate_token
4
+ Digest::MD5.new.update(rand(10).to_s).to_s
5
+ end
6
+
7
+ ACCESS_ID = generate_token
8
+ ACCESS_PASS = generate_token
@@ -0,0 +1,21 @@
1
+ VCR.configure do |c|
2
+ c.cassette_library_dir = 'fixtures/vcr_cassettes'
3
+ c.hook_into :webmock
4
+ c.allow_http_connections_when_no_cassette = true
5
+ c.default_cassette_options = { :record => :new_episodes }
6
+ c.filter_sensitive_data('<SHOP_ID>') { SPEC_CONF["shop_id"] }
7
+ c.filter_sensitive_data('<SHOP_PASS>') { SPEC_CONF["shop_pass"] }
8
+ c.filter_sensitive_data('<SITE_ID>') { SPEC_CONF["site_id"] }
9
+ c.filter_sensitive_data('<SITE_PASS>') { SPEC_CONF["site_pass"] }
10
+ c.filter_sensitive_data('<SITE_PASS>') { SPEC_CONF["site_pass"] }
11
+ c.filter_sensitive_data('<ACCESS_ID>') { ACCESS_ID }
12
+ c.filter_sensitive_data('<ACCESS_PASS>') { ACCESS_PASS }
13
+ end
14
+
15
+ RSpec.configure do |c|
16
+ c.treat_symbols_as_metadata_keys_with_true_values = true
17
+ c.around(:each, :vcr) do |example|
18
+ name = example.metadata[:full_description].split(/\s+/, 2).join("/").gsub(/[^\w\/]+/, "_")
19
+ VCR.use_cassette(name) { example.call }
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ - rbx-18mode
6
+ - rbx-19mode
7
+ - ruby-head
8
+ - jruby-19mode
9
+ - jruby-18mode
10
+ - jruby-head
11
+ - 1.8.7
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gmo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tatsuo Kaniwa
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rack
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: multi_json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: vcr
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: webmock
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Ruby client library for the GMO Payment Platform.
111
+ email:
112
+ - tatsuo@kaniwa.biz
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files:
116
+ - README.md
117
+ files:
118
+ - .gitignore
119
+ - Gemfile
120
+ - README.ja.md
121
+ - README.md
122
+ - Rakefile
123
+ - autotest/discover.rb
124
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_change_order_auth_to_sale.yml
125
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_gets_data_about_order.yml
126
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_got_error_if_missing_options.yml
127
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_gets_data_about_order.yml
128
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_got_error_if_missing_options.yml
129
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml
130
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml
131
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml
132
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml
133
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_gets_data_about_order.yml
134
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_got_error_if_missing_options.yml
135
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_gets_data_about_order.yml
136
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_got_error_if_missing_options.yml
137
+ - fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_error_if_missing_options.yml
138
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_card_gets_data_about_a_card.yml
139
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_member_gets_data_about_a_member.yml
140
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_gets_data_about_a_card.yml
141
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_gets_data_about_a_transaction.yml
142
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_got_error_if_missing_options.yml
143
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_gets_data_about_a_card.yml
144
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_member_gets_data_about_a_member.yml
145
+ - fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_update_member_gets_data_about_a_transaction.yml
146
+ - gmo.gemspec
147
+ - lib/gmo.rb
148
+ - lib/gmo/errors.rb
149
+ - lib/gmo/http_services.rb
150
+ - lib/gmo/shop_and_site_api.rb
151
+ - lib/gmo/shop_api.rb
152
+ - lib/gmo/site_api.rb
153
+ - lib/gmo/version.rb
154
+ - spec/gmo/api_spec.rb
155
+ - spec/gmo/error_spec.rb
156
+ - spec/gmo/http_service_spec.rb
157
+ - spec/gmo/shop_and_site_api_spec.rb
158
+ - spec/gmo/shop_api_spec.rb
159
+ - spec/gmo/site_api_spec.rb
160
+ - spec/spec_helper.rb
161
+ - spec/support/config.example.yml
162
+ - spec/support/config.yml
163
+ - spec/support/config_loader.rb
164
+ - spec/support/factory.rb
165
+ - spec/support/vcr.rb
166
+ - travis.yml
167
+ homepage: ''
168
+ licenses: []
169
+ post_install_message:
170
+ rdoc_options:
171
+ - --line-numbers
172
+ - --inline-source
173
+ - --title
174
+ - GMO
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ! '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ segments:
184
+ - 0
185
+ hash: 1156839914237704881
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ! '>='
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ segments:
193
+ - 0
194
+ hash: 1156839914237704881
195
+ requirements: []
196
+ rubyforge_project:
197
+ rubygems_version: 1.8.25
198
+ signing_key:
199
+ specification_version: 3
200
+ summary: ! 'GMO Payment API client: Ruby client library for the GMO Payment Platform.'
201
+ test_files: []
202
+ has_rdoc: