girlscout 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a99e3a73cad13c9706618f33156409078b88197
4
- data.tar.gz: c5b8f193355bcb154ed20585a66d0c4fa51bafe1
3
+ metadata.gz: e1db9fef9c041a2c4a3964613d2a90fe107af20a
4
+ data.tar.gz: c403edcb316e05b97291a5ec307ff779128dc1d1
5
5
  SHA512:
6
- metadata.gz: e2662d4c3defe52c44bd6b1e821fbd0310574623afd5ad532192080ba3edc37e0c85af3b7bfd39b70ad44126727283d7218151854ea538c8556f22ead779ea62
7
- data.tar.gz: 66165ecdec0431b54f53e65c8970538a8bdbf3d565ce03fc984ebefcca40d14300c1906e03ab0e6c5827ac091df260f7db3827ec20c8bab4859eecf103c186c2
6
+ metadata.gz: 1abb94c3622a62932338675a1ac98768610cd4e2755652cb68988280d6600065971f448f2e91d27b2bbb96457109e22f5a347226d752b2f50d71b0a182a096f6
7
+ data.tar.gz: 929ca13c7367819b2e6105f4de1cbd01882ddb569c676cdbccc89544ca847daffeadf40dd219e10507c567c346dbee9914ab1f9fbff6cb77afb477b162918dcd
@@ -15,3 +15,4 @@ require 'girlscout/attachment'
15
15
  require 'girlscout/thread'
16
16
  require 'girlscout/customer'
17
17
  require 'girlscout/user'
18
+ require 'girlscout/search'
@@ -8,7 +8,7 @@ module GirlScout
8
8
  end
9
9
 
10
10
  def create(attributes)
11
- attributes = attributes.as_json if attributes.is_a?(Object)
11
+ attributes = attributes.as_json if attributes.respond_to?(:as_json)
12
12
  attributes["reload"] ||= true
13
13
  Conversation.new(resource.post(attributes)["item"])
14
14
  end
@@ -9,7 +9,7 @@ module GirlScout
9
9
 
10
10
  def rest_resource
11
11
  return @rest_resource if @rest_resource
12
- return @rest_resource = @options[:resource] if @options[:resource]
12
+ return @rest_resource = @options[:rest_resource] if @options[:rest_resource]
13
13
 
14
14
  resource_class = @options[:resource_class] || RestClient::Resource
15
15
  @rest_resource = resource_class.new("#{@url}.json", @options)
@@ -0,0 +1,15 @@
1
+ module GirlScout
2
+ class Search < GirlScout::Object
3
+ endpoint '/search'
4
+
5
+ class << self
6
+ def conversations(query)
7
+ List.new(resource['/conversations'].get(query: query), Conversation)
8
+ end
9
+
10
+ def customers(query)
11
+ List.new(resource['/customers'].get(query: query), Customer)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -11,5 +11,11 @@ module GirlScout
11
11
  creator_type = attr["type"].capitalize.constantize rescue User
12
12
  @created_by ||= creator_type.new(attr)
13
13
  end
14
+
15
+ def as_json
16
+ json = super
17
+ json["createdBy"] = created_by.as_json if key?("created_by")
18
+ json
19
+ end
14
20
  end
15
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: girlscout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chakrit Wichian
@@ -126,6 +126,7 @@ files:
126
126
  - lib/girlscout/mailbox.rb
127
127
  - lib/girlscout/object.rb
128
128
  - lib/girlscout/resource.rb
129
+ - lib/girlscout/search.rb
129
130
  - lib/girlscout/thread.rb
130
131
  - lib/girlscout/user.rb
131
132
  homepage: https://www.omise.co