phraseapp-ruby 1.0.21 → 1.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.
@@ -74,7 +74,7 @@ module PhraseApp
74
74
  end
75
75
  end
76
76
 
77
- def self.send_request_paginated(method, path_with_query, ctype, body, status, page, per_page)
77
+ def self.send_request_paginated(credentials, method, path_with_query, ctype, body, status, page, per_page)
78
78
  uri = URI.parse(path_with_query)
79
79
 
80
80
  hash = if uri.query then CGI::parse(uri.query) else {} end
@@ -84,17 +84,17 @@ module PhraseApp
84
84
  query_str = URI.encode_www_form(hash)
85
85
  path = [uri.path, query_str].compact.join('?')
86
86
 
87
- return send_request(method, path, ctype, body, status)
87
+ return send_request(credentials, method, path, ctype, body, status)
88
88
  end
89
89
 
90
- def self.send_request(method, path, ctype, data, status)
90
+ def self.send_request(credentials, method, path, ctype, data, status)
91
91
  req = Net::HTTPGenericRequest.new(method,
92
92
  Module.const_get("Net::HTTP::#{method.capitalize}::REQUEST_HAS_BODY"),
93
93
  Module.const_get("Net::HTTP::#{method.capitalize}::RESPONSE_HAS_BODY"),
94
94
  path)
95
95
 
96
96
 
97
- if PhraseApp::Auth.debug
97
+ if credentials.debug
98
98
  puts "-------"
99
99
  puts "data:"
100
100
  puts data.inspect
@@ -107,23 +107,22 @@ module PhraseApp
107
107
  req["Content-Type"] = ctype
108
108
  end
109
109
 
110
- resp, err = send(req, status)
110
+ resp, err = http_send(credentials, req, status)
111
111
 
112
112
 
113
113
  return resp, err
114
114
  end
115
115
 
116
- def self.send(req, status)
117
- err = PhraseApp::Auth.authenticate(req)
116
+ def self.http_send(credentials, req, status)
117
+ err = credentials.authenticate(req)
118
118
  if err != nil
119
119
  return nil, err
120
120
  end
121
121
 
122
122
  req["User-Agent"] = API_CLIENT_IDENTIFIER
123
+ uri = URI.parse(credentials.host)
123
124
 
124
- uri = URI.parse(PhraseApp::Auth.host)
125
-
126
- if PhraseApp::Auth.debug
125
+ if credentials.debug
127
126
  puts "uri:"
128
127
  puts uri.inspect
129
128
  end
@@ -132,14 +131,14 @@ module PhraseApp
132
131
 
133
132
  if uri.is_a?(URI::HTTPS)
134
133
  http.use_ssl = true
135
- if PhraseApp::Auth::skip_ssl_verification
134
+ if credentials.skip_ssl_verification
136
135
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
137
136
  else
138
137
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
139
138
  end
140
139
  end
141
140
 
142
- if PhraseApp::Auth.debug
141
+ if credentials.debug
143
142
  puts "method:"
144
143
  puts req.method
145
144
  puts "path:"
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PhraseApp
2
- VERSION = '1.0.21'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phraseapp-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.21
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhraseApp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-12 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PhraseApp API client libary
14
14
  email: