yordex 0.0.7 → 0.0.8

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/yordex.rb +52 -25
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d7a32fd30d1990d018a2cc4a9fa31cc5c0b3f44
4
- data.tar.gz: ef445108a290bbffb9d4cec43a1156eaaae6d28d
3
+ metadata.gz: 7fe4dc45811f54acea9871854d9d6dc97cfdbb6b
4
+ data.tar.gz: 75c0cd97e2321826e44b7e809a130f088ce9e60f
5
5
  SHA512:
6
- metadata.gz: 6fd5d1b67f38a519a82ea93f6ca38c10871609c3722a10db33e23c85d585ac0368a091b240e51f0d4cdbbaa2d2298cc6adbc95ae3e71af83f259de15457ebd40
7
- data.tar.gz: dbfd45c1c212e807ec7c289cd9b6fb093fb507e2bed60fc9bf2819ad412a5d5827c3625ac508470421be3d8dd6a99a7afc3c0cdfe5db372b2253f97ecc957fc7
6
+ metadata.gz: 7544ba136dbaccae6cf0c95021ec17661fef057e16025af45723c3c044bf0dd0505a42213378fb540b4959eb0487c7b01c53a5eff3185c7e7b189b8f005d9571
7
+ data.tar.gz: ff7fc7d2fb5cdb089e8a389cb7fb2c141174765bdf315c2345026996ca4b6ecdec34682d6b4693741f1626d3715731cdd2c9302de652f4aee8722e547263c577
@@ -76,36 +76,63 @@ class Yordex
76
76
  end
77
77
 
78
78
  def create_trader(partner_id, email, password, company_name, company_address_1, company_city, company_country_code, company_postal_code)
79
+ _json = if ((company_address_1.nil? || company_address_1.empty?) &&
80
+ (company_city.nil? || company_city.empty?) &&
81
+ (company_country_code.nil? || company_country_code.empty?) &&
82
+ (company_postal_code.nil? || company_postal_code.empty?))
83
+ then
84
+ {
85
+ "partnerId"=>partner_id,
86
+ "user" =>{
87
+ "email"=>email,
88
+ "password"=>password
89
+ },
90
+ "companyTradingName"=>company_name
91
+ }
92
+ else
93
+ {
94
+ "partnerId"=>partner_id,
95
+ "user" =>{
96
+ "email"=>email,
97
+ "password"=>password
98
+ },
99
+ "companyTradingName"=>company_name,
100
+ "companyTradingAddress"=> {
101
+ "address1"=>company_address_1,
102
+ "city"=>company_city,
103
+ "countryCode"=>company_country_code,
104
+ "postalCode"=>company_postal_code
105
+ }
106
+ }
107
+ end
108
+
79
109
  return master_http(@@api_base+"/traders", "post",
80
- {'Authorization'=>@@api_key, 'Content-type'=>'application/json', 'Accept'=>'application/json'},
81
- {
82
- "partnerId"=>partner_id,
83
- "user" =>{
84
- "email"=>email,
85
- "password"=>password
86
- },
87
- "companyTradingName"=>company_name,
88
- "companyTradingAddress"=> {
89
- "address1"=>company_address_1,
90
- "city"=>company_city,
91
- "countryCode"=>company_country_code,
92
- "postalCode"=>company_postal_code
93
- }
94
- })
110
+ {'Authorization'=>@@api_key, 'Content-type'=>'application/json', 'Accept'=>'application/json'}, _json)
95
111
  end
96
112
 
97
113
  def update_trader(trader_id, company_name, address_1, city, country_code, postal_code)
114
+ _json = if ((address_1.nil? || address_1.empty?) &&
115
+ (city.nil? || city.empty?) &&
116
+ (country_code.nil? || country_code.empty?) &&
117
+ (postal_code.nil? || postal_code.empty?))
118
+ then
119
+ {
120
+ "companyTradingName"=>company_name
121
+ }
122
+ else
123
+ {
124
+ "companyTradingName"=>company_name,
125
+ "companyTradingAddress"=> {
126
+ "address1"=>address_1,
127
+ "city"=>city,
128
+ "countryCode"=>country_code,
129
+ "postalCode"=>postal_code
130
+ }
131
+ }
132
+ end
133
+
98
134
  return master_http(@@api_base+"/traders/"+trader_id, "put",
99
- {'Authorization'=>@@api_key, 'Content-type'=>'application/json', 'Accept'=>'application/json'},
100
- {
101
- "companyTradingName"=>company_name,
102
- "companyTradingAddress"=> {
103
- "address1"=>address_1,
104
- "city"=>city,
105
- "countryCode"=>country_code,
106
- "postalCode"=>postal_code
107
- }
108
- })
135
+ {'Authorization'=>@@api_key, 'Content-type'=>'application/json', 'Accept'=>'application/json'}, _json)
109
136
  end
110
137
 
111
138
  def create_order(buyer_id, seller_id, description, order_amount_in_cents, order_currency, terms)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yordex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Odendaal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-18 00:00:00.000000000 Z
11
+ date: 2017-08-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Yordex Ruby Gem
14
14
  email: andrew@hsmoore.com