nissen-collect 0.1.4 → 0.1.5

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTQ3Y2QxZTU2ZGZhOTE0ZWQwNTg2ODI5Njc5MDI2MGMzNDBiMDZkNA==
4
+ NzQ5ZTI4ZDYxODk3NGY3NGY1ODRiMjUxY2U3NjMyZmJhZjdlOTYxZA==
5
5
  data.tar.gz: !binary |-
6
- ZTkyODBkMTRmZDA1MzFmNjJlZTUyMjExMDdiNzYxOTYwMWQzNTM1NA==
6
+ MTNhNzIwNDU0OWZhMWI0NTc0NGZkNThlNGQ3OTRhZjRjOGJjZmQ0Nw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2I2NWVmY2Q1ODIwZWY5NDA1ZGI0NmMyZGU4NjAwYWUzNjIxNzIyM2JjZWM4
10
- ZDg1ZGMyZjJhMjE4YjhiNThiMDBlNWE1NzUyYTRhYmJjZTRiMTNkNzM5ODkx
11
- ZGJlMWJkZmFhZjc5YmI2ODJiNzJlZmUzZDg1MTg5MmQ0ZTUzZGE=
9
+ MjEyNDYxZDhmODJiYWQ1YTEzNzdmM2Q3ZmJlZTFiZWE1YThlMjQ5MzBjYjNl
10
+ MDYxNmEzNjE4ZDYzM2E0ZDU0NmQxNTU2MzkzZDQ0Yzg1ZDFmMTgxYjNjMjhm
11
+ ZmZlMjJlNDhlZjFiZWFmYjhjYjUyMDAyMmUxZTg2MWIxMmU1MDM=
12
12
  data.tar.gz: !binary |-
13
- NjlmZjA5ZWYxYzM1MGRhZDI2NDMwYmVjOTljZTUwODQxZGMzNTMzMGU5ZDg3
14
- MGNhMmIzMzMwNDFkNGI2M2JkZWQ1NGIwYzk3YTY4OTNkMzFiYWEyMTE4ODkw
15
- M2Y2ZWRlMTA1YjUzNWJiNGM2MDk3Mzg3MTM2OTgyZjMzY2QyMDM=
13
+ M2I3ZjJlNmI3YmUxYTdkMTNkN2E0MDAwZTI1YmIwOTg0MWFhNGIzM2Q1YTRm
14
+ NzNhYjc1ZmU4NGIwYWY3YTVhYzNmYTBhYjc1Y2RhYWJmODY0MTEyNDRkMTIy
15
+ YTM5OTBlNGY3Njg1MjVkNWQxY2E3NjU3Y2IwYTgwMmQxMmIwOTQ=
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module NissenCollect
3
+
4
+ class Action
5
+
6
+ # 環境変数を設定する
7
+ def initialize
8
+ @@shopInfo = {
9
+ :shopInfo=>{
10
+ :shopCode=> ENV['NISSEN_COLLECT_SHOPCODE'],
11
+ :shopPassword=> ENV['NISSEN_COLLECT_PASSWORD'],
12
+ :terminalId=> ENV['NISSEN_COLLECT_TERMINALID']
13
+ }
14
+ }
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -2,20 +2,20 @@
2
2
  deliveries:
3
3
  delivery:
4
4
  deliveryCustomer:
5
- fullName:
6
- firstName:
7
- lastName:
8
- fullKanaName:
9
- firstKanaName:
10
- lastKanaName:
11
- zipCode:
12
- address1:
13
- address2:
14
- address3:
15
- companyName:
16
- departmentName:
17
- tel:
18
- email:
5
+ fullName:
6
+ firstName:
7
+ lastName:
8
+ fullKanaName:
9
+ firstKanaName:
10
+ lastKanaName:
11
+ zipCode:
12
+ address1:
13
+ address2:
14
+ address3:
15
+ companyName:
16
+ departmentName:
17
+ tel:
18
+ email:
19
19
  details:
20
20
  detail:
21
21
  detailId:
@@ -1,20 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module NissenCollect
3
3
 
4
- class Cancel
5
- attr_accessor :body
4
+ class Cancel < Action
5
+ attr_accessor :transaction
6
6
  @@transaction_path = 'direct/autocancel.do'
7
7
 
8
8
  # @bodyを初期化する
9
9
  # @param [Hash] body 生成時引数
10
- def initialize body=nil
11
- @body = body ? body : [SHOPINFO,TRANSACTION].inject {|union,hash| union.merge hash}
10
+ def initialize
11
+ super
12
+ @transaction = TRANSACTION
12
13
  end
13
14
 
14
15
  # APIコールを行う
15
16
  def call
17
+ body = [@@shopInfo,@transaction].inject {|union,hash| union.merge hash}
16
18
  connect = NissenCollect::Client.new
17
- connect.request('get',@@transaction_path,@body)
19
+ connect.request('get',@@transaction_path,body)
18
20
  end
19
21
 
20
22
  end
@@ -1,20 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module NissenCollect
3
3
 
4
- class Getauthor
5
- attr_accessor :body
4
+ class Getauthor < Action
5
+ attr_accessor :buyer
6
6
  @@transaction_path = 'direct/autogetauthor.do'
7
7
 
8
8
  # @bodyを初期化する
9
9
  # @param [Hash] body 生成時引数
10
- def initialize body=nil
11
- @body = body ? body : [SHOPINFO,BUYER].inject {|union,hash| union.merge hash}
10
+ def initialize
11
+ super
12
+ @buyer = BUYER
12
13
  end
13
14
 
14
15
  # APIコールを行う
15
16
  def call
17
+ body = [@@shopInfo,@buyer].inject {|union,hash| union.merge hash}
16
18
  connect = NissenCollect::Client.new
17
- connect.request('get',@@transaction_path,@body)
19
+ connect.request('get',@@transaction_path,body)
18
20
  end
19
21
 
20
22
  end
@@ -1,20 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module NissenCollect
3
3
 
4
- class Modifytransaction
5
- attr_accessor :body
4
+ class Modifytransaction < Action
5
+ attr_accessor :buyer,:deliveries
6
6
  @@transaction_path = 'direct/automodifytransaction.do'
7
7
 
8
8
  # @bodyを初期化する
9
9
  # @param [Hash] body 生成時引数
10
- def initialize body=nil
11
- @body = body ? body : [SHOPINFO,BUYER,DELIVERIES].inject {|union,hash| union.merge hash}
10
+ def initialize
11
+ super
12
+ @buyer = BUYER
13
+ @deliveries = DELIVERIES
12
14
  end
13
15
 
14
16
  # APIコールを行う
15
17
  def call
18
+ body = [@@shopInfo,@buyer,@deliveries].inject {|union,hash| union.merge hash}
16
19
  connect = NissenCollect::Client.new
17
- connect.request('get',@@transaction_path,@body)
20
+ connect.request('get',@@transaction_path,body)
18
21
  end
19
22
 
20
23
  end
@@ -1,20 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module NissenCollect
3
3
 
4
- class Pdrequest
5
- attr_accessor :body
4
+ class Pdrequest < Action
5
+ attr_accessor :transaction,:pdrequest
6
6
  @@transaction_path = 'direct/autotransaction.do'
7
7
 
8
8
  # @bodyを初期化する
9
9
  # @param [Hash] body 生成時引数
10
- def initialize body=nil
11
- @body = body ? body : [SHOPINFO,TRANSACTION,PDREQUEST].inject {|union,hash| union.merge hash}
10
+ def initialize
11
+ super
12
+ @transaction = TRANSACTION
13
+ @pdrequest = PDREQUEST
12
14
  end
13
15
 
14
16
  # APIコールを行う
15
17
  def call
18
+ body = [@@shopInfo,@transaction,@pdrequest].inject {|union,hash| union.merge hash}
16
19
  connect = NissenCollect::Client.new
17
- connect.request('get',@@transaction_path,@body)
20
+ connect.request('get',@@transaction_path,body)
18
21
  end
19
22
 
20
23
  end
@@ -1,20 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module NissenCollect
3
3
 
4
- class Transaction
5
- attr_accessor :body
4
+ class Transaction < Action
5
+ attr_accessor :httpInfo,:buyer,:deliveries
6
6
  @@transaction_path = 'direct/autotransaction.do'
7
7
 
8
8
  # @bodyを初期化する
9
9
  # @param [Hash] body 生成時引数
10
- def initialize body=nil
11
- @body = body ? body : [SHOPINFO,HTTPINFO,BUYER,DELIVERIES].inject {|union,hash| union.merge hash}
10
+ def initialize
11
+ super
12
+ @httpInfo = HTTPINFO
13
+ @buyer = BUYER
14
+ @deliveries = DELIVERIES
12
15
  end
13
16
 
14
17
  # APIコールを行う
15
18
  def call
19
+ body = [@@shopInfo,@httpInfo,@buyer,@deliveries].inject {|union,hash| union.merge hash}
16
20
  connect = NissenCollect::Client.new
17
- connect.request('get',@@transaction_path,@body)
21
+ connect.request('get',@@transaction_path,body)
18
22
  end
19
23
 
20
24
  end
@@ -1,4 +1,4 @@
1
1
  module NissenCollect
2
2
  # nissen-collect version
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
@@ -4,6 +4,7 @@ require 'faraday'
4
4
  require 'active_support/core_ext'
5
5
  require 'erb'
6
6
  require 'nissen-collect/version'
7
+ require 'nissen-collect/action.rb'
7
8
  require 'nissen-collect/transaction.rb'
8
9
  require 'nissen-collect/getauthor.rb'
9
10
  require 'nissen-collect/modifytransaction.rb'
@@ -13,7 +14,6 @@ require 'nissen-collect/cancel.rb'
13
14
  # nissen collect APIwrapper
14
15
  module NissenCollect
15
16
  ROOT_HOST = 'https://collect-operation.nissen.co.jp/'
16
- SHOPINFO = HashWithIndifferentAccess.new(YAML.load(ERB.new(File.read(File.expand_path('../nissen-collect/body/shopInfo.yml',__FILE__))).result))
17
17
  HTTPINFO = HashWithIndifferentAccess.new(YAML.load_file(File.expand_path('../nissen-collect/body/httpInfo.yml', __FILE__)))
18
18
  BUYER = HashWithIndifferentAccess.new(YAML.load_file(File.expand_path('../nissen-collect/body/buyer.yml', __FILE__)))
19
19
  DELIVERIES = HashWithIndifferentAccess.new(YAML.load_file(File.expand_path('../nissen-collect/body/deliveries.yml', __FILE__)))
@@ -51,10 +51,6 @@ module NissenCollect
51
51
  def request method, target_path, params
52
52
  request_setup = request_setup(target_path, params.to_xml(root:'request'))
53
53
  connection.send(method.to_sym, &request_setup).env
54
- rescue Faraday::Error::ClientError
55
- raise Twitter::Error::ClientError
56
- rescue JSON::ParserError
57
- raise Twitter::Error::ParserError
58
54
  end
59
55
  end
60
56
 
@@ -19,8 +19,8 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
21
21
  gem.add_development_dependency 'rspec', '~> 2.4'
22
- gem.add_development_dependency 'yard', '~> 0.8'
22
+ gem.add_development_dependency 'yard', '>= 0.8'
23
23
  gem.add_dependency 'faraday', '~> 0.8'
24
- gem.add_dependency 'activesupport', '~> 3.0'
24
+ gem.add_dependency 'activesupport', '>= 3.0'
25
25
 
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nissen-collect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - yu1ch1
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-30 00:00:00.000000000 Z
11
+ date: 2013-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubygems-tasks
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.8'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.8'
55
55
  - !ruby/object:Gem::Dependency
@@ -70,14 +70,14 @@ dependencies:
70
70
  name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
83
  description: transaction,getauthor,modifytransaction,pdrequest,cancel
@@ -99,11 +99,11 @@ files:
99
99
  - README.rdoc
100
100
  - Rakefile
101
101
  - lib/nissen-collect.rb
102
+ - lib/nissen-collect/action.rb
102
103
  - lib/nissen-collect/body/PdRequest.yml
103
104
  - lib/nissen-collect/body/buyer.yml
104
105
  - lib/nissen-collect/body/deliveries.yml
105
106
  - lib/nissen-collect/body/httpInfo.yml
106
- - lib/nissen-collect/body/shopInfo.yml
107
107
  - lib/nissen-collect/body/transaction.yml
108
108
  - lib/nissen-collect/cancel.rb
109
109
  - lib/nissen-collect/getauthor.rb
@@ -1,5 +0,0 @@
1
- #注文情報登録API リクエストパラメータ
2
- shopInfo:
3
- shopCode: <%= ENV['NISSEN_COLLECT_SHOPCODE'] %>
4
- shopPassword: <%= ENV['NISSEN_COLLECT_PASSWORD'] %>
5
- terminalId: <%= ENV['NISSEN_COLLECT_TERMINALID'] %>