gateway-sdk 1.0.3 → 1.0.4

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: f3752223f6aa5a6b06b50b1c41291e880f2a16a0
4
- data.tar.gz: ec96f27d284b6ae240d1cb377e48ea58ab2831a8
3
+ metadata.gz: 97a5a30ab2e4bcd30f06b47688c8d058af21b770
4
+ data.tar.gz: c33c0e8617c931fe55e231f157f388b496b28265
5
5
  SHA512:
6
- metadata.gz: 7f48737f9d9d85e26b63e59a23fcfe0cfc852fe25ff83e5056a2d49490e6b04f3beea51ba0b9e39f9baf4c89bdea5b9d64901f1397e8908d17276c1bfe5424dd
7
- data.tar.gz: 20ae6f62ab0eb473f2864194c34f449cfb048cbef376c3efe67fc9a03da74ae4096e32cdc2359b204b8b5e056bdb66729b9ea0e769278ca970d24af313f82e31
6
+ metadata.gz: d06fb18915c1807b6c1abee653011645e806cc184b2f09d9870cb7166ba542efcb5d748fd9fa18b9defa15a3cedb9afad8bc6e727cef65c2ec9d7672226efff1
7
+ data.tar.gz: cc25e145f5e38745a50c991a0cf706b5f90bcb73e66fe466dbd73a94e24018e5adf4743bc6b8ca7cc9e2397e7a34c1b4e586fc00b5b063c8751abf693dbd3bc8
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'rspec'
4
+ gem 'rest-client'
3
5
  # Specify your gem's dependencies in gateway-sdk.gemspec
4
6
  gemspec
@@ -49,7 +49,11 @@ module Gateway
49
49
  query_params.merge! request.attributes
50
50
  response = RestClient.get(url(query_params))
51
51
  when METHOD_POST
52
- response = RestClient.post(url(query_params), request.attributes, Authorization: @token)
52
+ if config_data.content_type == 'json'
53
+ response = RestClient.post(url(query_params), request.attributes.to_json, content_type: :json, Authorization: @token)
54
+ else
55
+ response = RestClient.post(url(query_params), request.attributes, Authorization: @token)
56
+ end
53
57
  else
54
58
  raise Gateway::ArgumentError.new("http method #{config_data.http_method} is not supported")
55
59
  end
@@ -5,6 +5,10 @@ api_methods:
5
5
  SendMessageRequest:
6
6
  route: "scheduler/by-phone-and-transport"
7
7
  http_method: "post"
8
+ InboxMessageRequest:
9
+ route: "external/receiver"
10
+ http_method: "post"
11
+ content_type: "json"
8
12
  SetProfileRequest:
9
13
  route: "scheduler/profile"
10
14
  http_method: "post"
@@ -0,0 +1,13 @@
1
+ module Gateway
2
+ module Requests
3
+ class Client < CommonRequest
4
+ attr_accessor :key, :avatar, :nickname
5
+
6
+ def initialize(attributes)
7
+ attributes.each do |name, value|
8
+ send("#{name}=", value) if respond_to? "#{name}="
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -15,11 +15,15 @@ module Gateway
15
15
  def attributes
16
16
  hash = {}
17
17
  instance_variables.each do |attr|
18
- hash[attr[1..-1]] = instance_variable_get attr
18
+ value = instance_variable_get attr
19
+ if value.is_a? Gateway::Requests::CommonRequest
20
+ hash[attr[1..-1]] = value.attributes
21
+ else
22
+ hash[attr[1..-1]] = value
23
+ end
19
24
  end
20
25
  hash
21
26
  end
22
-
23
27
  end
24
28
  end
25
29
  end
@@ -0,0 +1,8 @@
1
+ require File.expand_path('../common_request', __FILE__)
2
+ module Gateway
3
+ module Requests
4
+ class InboxMessageRequest < Gateway::Requests::CommonRequest
5
+ attr_accessor :device_key, :body, :image, :location, :client, :video
6
+ end
7
+ end
8
+ end
@@ -11,6 +11,7 @@ module Gateway
11
11
  TRANSPORT_TG = 'telegram' # transport telegram
12
12
  TRANSPORT_SMS = 'modem' # transport modem
13
13
  TRANSPORT_FACEBOOK = 'facebook' # transport facebook
14
+ TRANSPORT_EXTERNAL = 'external' # transport external
14
15
 
15
16
  attr_accessor :phone, :devicePhone, :body, :image, :transport, :plannedDate
16
17
 
@@ -18,7 +19,7 @@ module Gateway
18
19
  # Possible transports
19
20
  #
20
21
  def self.possible_transports
21
- [TRANSPORT_WA, TRANSPORT_VIBER, TRANSPORT_TG, TRANSPORT_SMS, TRANSPORT_FACEBOOK]
22
+ [TRANSPORT_WA, TRANSPORT_VIBER, TRANSPORT_TG, TRANSPORT_SMS, TRANSPORT_FACEBOOK, TRANSPORT_EXTERNAL]
22
23
  end
23
24
 
24
25
  def transport=(transport)
@@ -1,3 +1,3 @@
1
1
  module Gateway
2
- VERSION = '1.0.3' # gem version
2
+ VERSION = '1.0.4' # gem version
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gateway-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - atanych
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-12 00:00:00.000000000 Z
11
+ date: 2016-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,9 @@ files:
89
89
  - lib/gateway/client.rb
90
90
  - lib/gateway/config.yml
91
91
  - lib/gateway/errors.rb
92
+ - lib/gateway/requests/client.rb
92
93
  - lib/gateway/requests/common_request.rb
94
+ - lib/gateway/requests/inbox_message_request.rb
93
95
  - lib/gateway/requests/send_message_request.rb
94
96
  - lib/gateway/requests/set_profile_request.rb
95
97
  - lib/gateway/version.rb