Class: OrbitMembers::Request
- Inherits:
-
Object
- Object
- OrbitMembers::Request
- Defined in:
- lib/orbit_members/request.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#member_id ⇒ Object
readonly
Returns the value of attribute member_id.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
-
#workspace_id ⇒ Object
readonly
Returns the value of attribute workspace_id.
Instance Method Summary collapse
- #add_identity ⇒ Object
- #after_initialize! ⇒ Object
- #create_member ⇒ Object
- #delete_member ⇒ Object
- #find_member_by_identity ⇒ Object
- #get_member ⇒ Object
-
#initialize(params = {}) ⇒ Request
constructor
A new instance of Request.
- #list_members ⇒ Object
- #remove_identity ⇒ Object
- #update_member ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/orbit_members/request.rb', line 9 def initialize(params = {}) @action = params.fetch(:action) @api_key = params.fetch(:api_key) @workspace_id = params.fetch(:workspace_id) @user_agent = params.fetch(:user_agent, "ruby-orbit-members/#{OrbitMembers::VERSION}") @body = params.fetch(:body, nil) @filters = params.fetch(:filters, nil) @member_id = params.fetch(:member_id, nil) @activity_id = params.fetch(:activity_id, nil) after_initialize! end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
7 8 9 |
# File 'lib/orbit_members/request.rb', line 7 def action @action end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/orbit_members/request.rb', line 7 def api_key @api_key end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/orbit_members/request.rb', line 7 def body @body end |
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
7 8 9 |
# File 'lib/orbit_members/request.rb', line 7 def filters @filters end |
#member_id ⇒ Object (readonly)
Returns the value of attribute member_id.
7 8 9 |
# File 'lib/orbit_members/request.rb', line 7 def member_id @member_id end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
7 8 9 |
# File 'lib/orbit_members/request.rb', line 7 def user_agent @user_agent end |
#workspace_id ⇒ Object (readonly)
Returns the value of attribute workspace_id.
7 8 9 |
# File 'lib/orbit_members/request.rb', line 7 def workspace_id @workspace_id end |
Instance Method Details
#add_identity ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/orbit_members/request.rb', line 72 def add_identity OrbitMembers::HTTP.post( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}/identities", user_agent: @user_agent, api_key: @api_key, body: @body ) end |
#after_initialize! ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/orbit_members/request.rb', line 22 def after_initialize! case @action when "create_member" create_member when "get_member" get_member when "list_members" list_members when "add_identity" add_identity when "remove_identity" remove_identity when "update_member" update_member when "delete_member" delete_member when "find_member_by_identity" find_member_by_identity else raise ArgumentError, "Activity type is unrecognized. Must be one of: create_member, update_member, get_member, list_members, add_identity, remove_identity, update_member, delete_member, find_member_by_identity" end end |
#create_member ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/orbit_members/request.rb', line 46 def create_member OrbitMembers::HTTP.post( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members", user_agent: @user_agent, api_key: @api_key, body: @body ) end |
#delete_member ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/orbit_members/request.rb', line 99 def delete_member OrbitMembers::HTTP.delete( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}", user_agent: @user_agent, api_key: @api_key ) end |
#find_member_by_identity ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/orbit_members/request.rb', line 107 def find_member_by_identity OrbitMembers::HTTP.get( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/find", user_agent: @user_agent, api_key: @api_key, filters: @filters ) end |
#get_member ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/orbit_members/request.rb', line 55 def get_member OrbitMembers::HTTP.get( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}", user_agent: @user_agent, api_key: @api_key ) end |
#list_members ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/orbit_members/request.rb', line 63 def list_members OrbitMembers::HTTP.get( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members", user_agent: @user_agent, api_key: @api_key, filters: @filters ) end |
#remove_identity ⇒ Object
81 82 83 84 85 86 87 88 |
# File 'lib/orbit_members/request.rb', line 81 def remove_identity OrbitMembers::HTTP.delete( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}/identities", user_agent: @user_agent, api_key: @api_key, body: @body ) end |
#update_member ⇒ Object
90 91 92 93 94 95 96 97 |
# File 'lib/orbit_members/request.rb', line 90 def update_member OrbitMembers::HTTP.put( url: "https://app.orbit.love/api/v1/#{@workspace_id}/members/#{@member_id}", user_agent: @user_agent, api_key: @api_key, body: @body ) end |